MCPcopy Create free account
hub / github.com/ccxt/ccxt / load_positions_snapshot

Method load_positions_snapshot

python/ccxt/pro/aster.py:1364–1377  ·  view source on GitHub ↗
(self, client, messageHash)

Source from the content-addressed store, hash-verified

1362 self.positions = ArrayCacheBySymbolBySide()
1363
1364 async def load_positions_snapshot(self, client, messageHash):
1365 positions = await self.fetch_positions()
1366 self.positions = ArrayCacheBySymbolBySide()
1367 cache = self.positions
1368 for i in range(0, len(positions)):
1369 position = positions[i]
1370 contracts = self.safe_number(position, 'contracts', 0)
1371 if contracts > 0:
1372 cache.append(position)
1373 # don't remove the future from the .futures cache
1374 if messageHash in client.futures:
1375 future = client.futures[messageHash]
1376 future.resolve(cache)
1377 client.resolve(cache, 'positions')
1378
1379 def handle_positions(self, client, message):
1380 #

Callers

nothing calls this directly

Calls 6

fetch_positionsMethod · 0.95
safe_numberMethod · 0.80
resolveMethod · 0.65
rangeFunction · 0.50
appendMethod · 0.45

Tested by

no test coverage detected