|
28 | 28 | from nautilus_trader.model.enums import AssetType
|
29 | 29 | from nautilus_trader.model.enums import BarAggregation
|
30 | 30 | from nautilus_trader.model.enums import PriceType
|
| 31 | +from nautilus_trader.model.identifiers import Exchange |
31 | 32 | from nautilus_trader.model.identifiers import Security
|
32 |
| -from nautilus_trader.model.identifiers import Venue |
| 33 | +from nautilus_trader.model.identifiers import Symbol |
33 | 34 |
|
34 | 35 | # The configuration dictionary can come from anywhere such as a JSON or YAML
|
35 | 36 | # file. Here it is hardcoded into the example for clarity.
|
|
87 | 88 | # Instantiate your strategies to pass into the trading node. You could add
|
88 | 89 | # custom options into the configuration file or even use another configuration
|
89 | 90 | # file.
|
| 91 | + |
| 92 | +security1 = Security( |
| 93 | + symbol=Symbol("ETH/USDT"), |
| 94 | + venue=Exchange("BINANCE"), |
| 95 | + asset_class=AssetClass.CRYPTO, |
| 96 | + asset_type=AssetType.SPOT, |
| 97 | +) |
| 98 | + |
90 | 99 | strategy1 = EMACross(
|
91 |
| - security=Security("ETH/USDT", Venue("BINANCE"), AssetClass.CRYPTO, AssetType.SPOT), |
| 100 | + security=security1, |
92 | 101 | bar_spec=BarSpecification(1, BarAggregation.MINUTE, PriceType.LAST),
|
93 | 102 | trade_size=Decimal("0.02"),
|
94 | 103 | fast_ema_period=10,
|
95 | 104 | slow_ema_period=20,
|
96 | 105 | order_id_tag="003",
|
97 | 106 | )
|
98 | 107 |
|
| 108 | +# ------------------------------------------------------------------------------ |
| 109 | + |
| 110 | +security2 = Security( |
| 111 | + symbol=Symbol("BTC/USD"), |
| 112 | + venue=Exchange("BITMEX"), |
| 113 | + asset_class=AssetClass.CRYPTO, |
| 114 | + asset_type=AssetType.SWAP, |
| 115 | +) |
| 116 | + |
99 | 117 | strategy2 = EMACrossStopEntryTrail(
|
100 |
| - security=Security("BTC/USD", Venue("BITMEX"), AssetClass.CRYPTO, AssetType.SWAP), |
| 118 | + security=security2, |
101 | 119 | bar_spec=BarSpecification(1, BarAggregation.MINUTE, PriceType.LAST),
|
102 | 120 | trade_size=Decimal("100"),
|
103 | 121 | fast_ema_period=10,
|
|
107 | 125 | order_id_tag="004",
|
108 | 126 | )
|
109 | 127 |
|
| 128 | +# ------------------------------------------------------------------------------ |
110 | 129 | # Instantiate the node passing a list of strategies and configuration
|
111 | 130 | node = TradingNode(strategies=[strategy1, strategy2], config=config)
|
112 | 131 |
|
|
0 commit comments