Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jbonilla-tao committed Feb 3, 2025
1 parent c05d5de commit f2491e2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions neurons/backtest_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ def update_current_hk_to_positions(self, cutoff_ms):
assert len(existing_positions) <= 1, f"Found multiple positions with the same UUID: {existing_positions}"
existing_position = existing_positions[0] if existing_positions else None
if existing_position:
print(f'OQU: Added order to existing position {position.trade_pair.trade_pair_id} at {time_formatted}. cutoff_ms {cutoff_ms_formatted}')
print(f'OQU: Added order to existing position {position.trade_pair.trade_pair_id} at {time_formatted}')
existing_position.orders.append(order)
existing_position.rebuild_position_with_updated_orders()
self.position_manager.save_miner_position(existing_position)
else: # first order. position must be inserted into list
print(f'OQU: Created new position {position.trade_pair.trade_pair_id} at {time_formatted}. cutoff_ms {cutoff_ms_formatted}')
print(f'OQU: Created new position {position.trade_pair.trade_pair_id} at {time_formatted} for hk {position.miner_hotkey}')
position.orders = [order]
position.rebuild_position_with_updated_orders()
self.position_manager.save_miner_position(position)
Expand Down Expand Up @@ -242,7 +242,8 @@ def update(self, current_time_ms:int):
for pos in test_positions:
hk_to_positions[pos['miner_hotkey']].append(Position(**pos))

btm = BacktestManager(hk_to_positions, start_time_ms, ValiUtils.get_secrets(), None)
secrets = ValiUtils.get_secrets() # {'polygon_apikey': '123', 'tiingo_apikey': '456'}
btm = BacktestManager(hk_to_positions, start_time_ms, secrets, None)
for t_ms in range(start_time_ms, max_order_time_ms + 1, 1000 * 60 * 60 * 24):
btm.update(t_ms)
perf_ledger_bundles = btm.perf_ledger_manager.get_perf_ledgers(portfolio_only=False)
Expand Down

0 comments on commit f2491e2

Please sign in to comment.