diff --git a/src/driftpy/accounts/cache/drift_client.py b/src/driftpy/accounts/cache/drift_client.py index c6bca9cc..47f421f3 100644 --- a/src/driftpy/accounts/cache/drift_client.py +++ b/src/driftpy/accounts/cache/drift_client.py @@ -81,9 +81,9 @@ async def update_cache(self): spot_market_and_slot.data.oracle, spot_market_and_slot.data.oracle_source, ) - oracle_data[ - str(spot_market_and_slot.data.oracle) - ] = oracle_price_data_and_slot + oracle_data[str(spot_market_and_slot.data.oracle)] = ( + oracle_price_data_and_slot + ) self.cache["spot_markets"] = spot_markets @@ -98,9 +98,9 @@ async def update_cache(self): perp_market_and_slot.data.amm.oracle, perp_market_and_slot.data.amm.oracle_source, ) - oracle_data[ - str(perp_market_and_slot.data.amm.oracle) - ] = oracle_price_data_and_slot + oracle_data[str(perp_market_and_slot.data.amm.oracle)] = ( + oracle_price_data_and_slot + ) self.cache["perp_markets"] = perp_markets @@ -128,9 +128,9 @@ async def update_cache(self): spot_market_and_slot.data.oracle, spot_market_and_slot.data.oracle_source, ) - oracle_data[ - str(spot_market_and_slot.data.oracle) - ] = oracle_price_data_and_slot + oracle_data[str(spot_market_and_slot.data.oracle)] = ( + oracle_price_data_and_slot + ) self.cache["spot_markets"] = spot_markets @@ -149,9 +149,9 @@ async def update_cache(self): perp_market_and_slot.data.amm.oracle, perp_market_and_slot.data.amm.oracle_source, ) - oracle_data[ - str(perp_market_and_slot.data.amm.oracle) - ] = oracle_price_data_and_slot + oracle_data[str(perp_market_and_slot.data.amm.oracle)] = ( + oracle_price_data_and_slot + ) self.cache["perp_markets"] = perp_markets diff --git a/src/driftpy/drift_client.py b/src/driftpy/drift_client.py index 9c6ede29..3e3eb466 100644 --- a/src/driftpy/drift_client.py +++ b/src/driftpy/drift_client.py @@ -1103,9 +1103,9 @@ async def place_spot_order( self.get_place_spot_order_ix(order_params, sub_account_id), ] ) - self.last_spot_market_seen_cache[ - order_params.market_index - ] = tx_sig_and_slot.slot + self.last_spot_market_seen_cache[order_params.market_index] = ( + tx_sig_and_slot.slot + ) self.last_spot_market_seen_cache[QUOTE_SPOT_MARKET_INDEX] = tx_sig_and_slot.slot return tx_sig_and_slot.tx_sig @@ -1151,9 +1151,9 @@ async def place_perp_order( self.get_place_perp_order_ix(order_params, sub_account_id), ] ) - self.last_perp_market_seen_cache[ - order_params.market_index - ] = tx_sig_and_slot.slot + self.last_perp_market_seen_cache[order_params.market_index] = ( + tx_sig_and_slot.slot + ) return tx_sig_and_slot.tx_sig def get_place_perp_order_ix( @@ -1199,13 +1199,13 @@ async def place_orders( for order_param in order_params: if is_variant(order_param.market_type, "Perp"): - self.last_perp_market_seen_cache[ - order_param.market_index - ] = tx_sig_and_slot.slot + self.last_perp_market_seen_cache[order_param.market_index] = ( + tx_sig_and_slot.slot + ) else: - self.last_spot_market_seen_cache[ - order_param.market_index - ] = tx_sig_and_slot.slot + self.last_spot_market_seen_cache[order_param.market_index] = ( + tx_sig_and_slot.slot + ) return tx_sig_and_slot.tx_sig @@ -1399,13 +1399,13 @@ async def cancel_and_place_orders( for order_param in place_order_params: if is_variant(order_param.market_type, "Perp"): - self.last_perp_market_seen_cache[ - order_param.market_index - ] = tx_sig_and_slot.slot + self.last_perp_market_seen_cache[order_param.market_index] = ( + tx_sig_and_slot.slot + ) else: - self.last_spot_market_seen_cache[ - order_param.market_index - ] = tx_sig_and_slot.slot + self.last_spot_market_seen_cache[order_param.market_index] = ( + tx_sig_and_slot.slot + ) return tx_sig_and_slot.tx_sig @@ -1525,9 +1525,9 @@ async def place_and_take_perp_order( ), ] ) - self.last_perp_market_seen_cache[ - order_params.market_index - ] = tx_sig_and_slot.slot + self.last_perp_market_seen_cache[order_params.market_index] = ( + tx_sig_and_slot.slot + ) return tx_sig_and_slot.tx_sig def get_place_and_take_perp_order_ix( @@ -1546,9 +1546,7 @@ def get_place_and_take_perp_order_ix( maker_infos = ( maker_info if isinstance(maker_info, list) - else [maker_info] - if maker_info - else [] + else [maker_info] if maker_info else [] ) user_accounts = [self.get_user_account(sub_account_id)] @@ -1623,9 +1621,9 @@ async def place_and_take_spot_order( ), ] ) - self.last_spot_market_seen_cache[ - order_params.market_index - ] = tx_sig_and_slot.slot + self.last_spot_market_seen_cache[order_params.market_index] = ( + tx_sig_and_slot.slot + ) return tx_sig_and_slot.tx_sig def get_place_and_take_spot_order_ix( @@ -1648,9 +1646,7 @@ def get_place_and_take_spot_order_ix( maker_infos = ( maker_info if isinstance(maker_info, list) - else [maker_info] - if maker_info - else [] + else [maker_info] if maker_info else [] ) for maker_info in maker_infos: user_accounts.append(maker_info.maker_user_account) @@ -2608,9 +2604,7 @@ async def get_fill_perp_order_ix( maker_info = ( maker_info if isinstance(maker_info, list) - else [maker_info] - if maker_info - else [] + else [maker_info] if maker_info else [] ) user_accounts = [user_account] diff --git a/src/driftpy/pickle/vat.py b/src/driftpy/pickle/vat.py index a7af5ae4..f6726109 100644 --- a/src/driftpy/pickle/vat.py +++ b/src/driftpy/pickle/vat.py @@ -106,9 +106,9 @@ def load_oracles( with open(perp_filename, "rb") as f: perp_oracles: list[PickledData] = pickle.load(f) for oracle in perp_oracles: - self.perp_oracles[ - oracle.pubkey - ] = oracle.data # oracle.pubkey is actually a market index + self.perp_oracles[oracle.pubkey] = ( + oracle.data + ) # oracle.pubkey is actually a market index else: raise FileNotFoundError(f"File {perp_filename} not found") @@ -116,8 +116,8 @@ def load_oracles( with open(spot_filename, "rb") as f: spot_oracles: list[PickledData] = pickle.load(f) for oracle in spot_oracles: - self.spot_oracles[ - oracle.pubkey - ] = oracle.data # oracle.pubkey is actually a market index + self.spot_oracles[oracle.pubkey] = ( + oracle.data + ) # oracle.pubkey is actually a market index else: raise FileNotFoundError(f"File {spot_filename} not found")