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
Copy file name to clipboardExpand all lines: README.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,24 +1,24 @@
1
-
##With this sample you`ll be able to:
1
+
##With this sample you`ll be able to:
2
2
* get order book (Level II, market depth) from [BitMEX](https://www.bitmex.com) and save as json structures in day-lenght files
3
3
* generate trading signals [BUY, SELL, WAIT] on orderbooks (not only BitMEX\`s) with or without help of sequential neural network
4
4
* create training dataset for neural network from presaved orderbooks
5
5
* create, train, save and restore neural network with input data of orderbooks (not only BitMEX`s)
6
6
* perform backtest trading with output of trades
7
7
8
-
###Limitations
8
+
###Limitations
9
9
*[BitMEX](https://www.bitmex.com) only and [XBTUSD](https://www.bitmex.com/app/contract/XBTUSD) data fetching only are provided. The source connection code taken from [Python Adapter for BitMEX Realtime Data](https://github.com/BitMEX/api-connectors/tree/master/official-ws/python)
10
10
* Code works correctly only for 100-depth order books.
11
11
* Neural network has voluntaristic rigid architecture where you can operate only number of layers and neurons quantity. Input layer must contain 100 neurons, output layer 2 neurons.
12
12
* No commissions, fees etc. are calculated while backtesting. Result trades must be extra analyzed.
13
13
14
14
15
-
##Installation
15
+
##Installation
16
16
```
17
17
pip install -r requirements.txt
18
18
```
19
19
20
-
##Use cases
21
-
####Retrieving order books ([Bitmex](https://www.bitmex.com) only)
20
+
##Use cases
21
+
####Retrieving order books ([Bitmex](https://www.bitmex.com) only)
22
22
Just run code below with your [API-key credentials to BitMEX](https://www.bitmex.com/app/apiKeysUsage).
23
23
On every update of market 100-depth order book is writing to disk.
24
24
[Bid-ask spread](https://en.wikipedia.org/wiki/Bid-ask_spread) is in the middle of order book. New trading day starts with new file.
@@ -35,7 +35,7 @@ bitmex.exit()
35
35
```
36
36
37
37
38
-
####Dataset creation for neural network training
38
+
####Dataset creation for neural network training
39
39
40
40
```python
41
41
from OrderBookContainer import*
@@ -49,7 +49,7 @@ for in_file in input_files:
49
49
As a result the script will create Datasets subfolder with \*.ds files.
50
50
51
51
52
-
####Neural network creation, training and saving for next time use
52
+
####Neural network creation, training and saving for next time use
53
53
54
54
My goal is just to show that neural networks work without price movement analysis but only on current market timestamp (== order book) analysis.
55
55
@@ -74,27 +74,27 @@ nwk.train(datasets_folder)
74
74
nwk.save_model('full_path_to_file.h5')
75
75
```
76
76
77
-
####Trading signal generation
77
+
####Trading signal generation
78
78
79
79
You can generate trading signal with possible values of [BUY, SELL, WAIT] with order book analysis only.
80
80
On every *orderbook* you get from exchange or read from file signal can be generated with code below.
81
81
*threshold* is floating point value in range [0, 1]. The less the value the more signals you get.
82
-
######Neural generator
82
+
######Neural generator
83
83
84
84
```python
85
85
from Generators import sample_generator_n
86
86
nwk = TurexNetwork.TurexNetwork()
87
87
nwk.load_model('model_from_code_above.h5')
88
88
signal = sample_generator_n(nwk, orderbook.volumes, threshold)
89
89
```
90
-
######Simple generator
90
+
######Simple generator
91
91
```python
92
92
from Generators import sample_generator
93
93
signal = sample_generator(orderbook.volumes, threshold)
0 commit comments