You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 5, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+18-1Lines changed: 18 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -92,15 +92,32 @@ Let's make sure everything worked out by running a sample strategy on the GDAX s
92
92
python3 -m algocoin --sandbox
93
93
```
94
94
95
-
### Writing an algorithm
95
+
### Writing a trading strategy
96
+
Trading strategies implement the `TradingStrategy` abstract class in `algocoin.lib.strategy`. This has a number of required methods for handling messages:
97
+
98
+
- onBuy
99
+
- onSell
100
+
- onTrade
101
+
- onChange
102
+
- onDone
103
+
- onError
104
+
- onOpen
105
+
- onReceived
106
+
107
+
There are also a variety of optional methods for more granular control over risk/execution/backtesting, such as `slippage`, `transactionCost`, `onHalt`, `onContinue`, etc.
96
108
97
109
### Backtesting
110
+
An instance of `TradingStrategy` class is able to run live or against a set of historical trade/quote data. When instantiating a `TradingEngine` object with a `TradingEngineConfig` object, the `TradingEngineConfig` has a `type` which can be set to `live`, `sandbox`, or `backtest`. Some additional methods are then usable on the `TradingStrategy`, including the `onAnalyze` method which allows you to visualize algorithm performance.
111
+
98
112
99
113
#### Getting Data
114
+
Historical data is relatively sparse, but the provided `fetchdata.sh` script will help grab historical data from bitcoincharts.com.
100
115
101
116
### Sandboxes
117
+
Currently only the Gemini sandbox is supported, the other exchanges have discontinued theirs. To run in sandbox, set `TradingEngineConfig.type` to Sandbox.
102
118
103
119
### Live Trading
120
+
When you want to run live, set `TradingEngineConfig.type` to Live. You will want to become familiar with the risk and execution engines, as these control things like max drawdown, max risk accrual, execution eagerness, etc.
0 commit comments