|
32 | 32 | from nautilus_trader.config import TradingNodeConfig
|
33 | 33 | from nautilus_trader.core.data import Data
|
34 | 34 | from nautilus_trader.live.node import TradingNode
|
35 |
| -from nautilus_trader.model.data import QuoteTick, TradeTick, Bar, DataType |
36 |
| -from nautilus_trader.model.identifiers import InstrumentId, ClientId, TraderId, Venue |
| 35 | +from nautilus_trader.model.data import Bar |
| 36 | +from nautilus_trader.model.data import DataType |
| 37 | +from nautilus_trader.model.data import QuoteTick |
| 38 | +from nautilus_trader.model.data import TradeTick |
| 39 | +from nautilus_trader.model.identifiers import ClientId |
| 40 | +from nautilus_trader.model.identifiers import InstrumentId |
| 41 | +from nautilus_trader.model.identifiers import TraderId |
| 42 | +from nautilus_trader.model.identifiers import Venue |
37 | 43 | from nautilus_trader.model.instruments import Instrument
|
38 | 44 | from nautilus_trader.trading import Strategy
|
39 | 45 | from nautilus_trader.trading.config import StrategyConfig
|
@@ -62,30 +68,24 @@ def on_start(self) -> None:
|
62 | 68 | if self.futures_instrument is None:
|
63 | 69 | self.log.error(
|
64 | 70 | f"Could not find instrument for {self.config.futures_instrument_id}"
|
65 |
| - f"\nPossible instruments: {self.cache.instrument_ids()}" |
| 71 | + f"\nPossible instruments: {self.cache.instrument_ids()}", |
66 | 72 | )
|
67 | 73 | self.stop()
|
68 | 74 | return
|
69 | 75 | self.spot_instrument = self.cache.instrument(self.config.spot_instrument_id)
|
70 | 76 | if self.spot_instrument is None:
|
71 | 77 | self.log.error(
|
72 | 78 | f"Could not find futures instrument for {self.config.spot_instrument_id}"
|
73 |
| - f"\nPossible instruments: {self.cache.instrument_ids()}" |
| 79 | + f"\nPossible instruments: {self.cache.instrument_ids()}", |
74 | 80 | )
|
75 | 81 | self.stop()
|
76 | 82 | return
|
77 | 83 |
|
78 | 84 | account = self.portfolio.account(venue=self.futures_instrument.venue)
|
79 |
| - balances = { |
80 |
| - str(currency): str(balance) |
81 |
| - for currency, balance in account.balances().items() |
82 |
| - } |
| 85 | + balances = {str(currency): str(balance) for currency, balance in account.balances().items()} |
83 | 86 | self.log.info(f"Futures balances\n{json.dumps(balances, indent=4)}", LogColor.GREEN)
|
84 | 87 | account = self.portfolio.account(venue=self.spot_instrument.venue)
|
85 |
| - balances = { |
86 |
| - str(currency): str(balance) |
87 |
| - for currency, balance in account.balances().items() |
88 |
| - } |
| 88 | + balances = {str(currency): str(balance) for currency, balance in account.balances().items()} |
89 | 89 | self.log.info(f"Spot balances\n{json.dumps(balances, indent=4)}", LogColor.GREEN)
|
90 | 90 |
|
91 | 91 | # Subscribe to live data
|
|
0 commit comments