Commit Graph

1450 Commits

Author SHA1 Message Date
c9s
ecf888dfd6 util: add env var util functions 2021-06-09 01:36:16 +08:00
c9s
ec6c10a96a binance: adjust read timeout and increase read buffer size 2021-06-09 01:36:06 +08:00
c9s
3fd170a4ff xmaker: check book before copying 2021-06-09 01:35:56 +08:00
c9s
f5a241a1a8 xmaker: improve warn message 2021-06-09 01:35:50 +08:00
c9s
a0d8a3718a xmaker: fix bid/ask price check 2021-06-07 02:50:11 +08:00
c9s
d5617d44aa xmaker: pass source market and maker market for formatting 2021-06-07 02:49:54 +08:00
c9s
0a74cc7171 xmaker: add useDepthPrice option 2021-06-07 02:49:44 +08:00
c9s
2486d04332 rbt: fix copyNode 2021-06-07 02:44:30 +08:00
c9s
5a5cb71a5e rbt: add more rbtorderbook test 2021-06-07 02:44:25 +08:00
c9s
062443a29c rbt: check if returned node is neel 2021-06-07 02:44:21 +08:00
c9s
3b0ed4e3dc rbt: add more test cases 2021-06-07 02:44:14 +08:00
c9s
9622956c71 rbt: fix rbtree search for neel 2021-06-07 02:44:09 +08:00
c9s
5d8f7b3ea6 rbt: fix preorder 2021-06-07 02:44:04 +08:00
c9s
7805dcd72e rbt: fix pointer check of iteration 2021-06-07 02:44:00 +08:00
c9s
9bc55def44 rbt: fix deleting, copy value to the deleting node's memory 2021-06-07 02:43:54 +08:00
c9s
f34631c7ae rbt: add pointer check 2021-06-07 02:43:50 +08:00
c9s
6d2771aca9 rbt: fix rightmost and leftmost 2021-06-07 02:43:43 +08:00
c9s
06bf0d0f2b rbt: fix rbtree deletion 2021-06-07 02:43:39 +08:00
c9s
103b1ea560 rbt: add rbt insert test 2021-06-07 02:43:34 +08:00
c9s
7512f56b84 rbt: avoid sharing rbtree neel pointer 2021-06-07 02:43:22 +08:00
c9s
f487b53d9e binance: fix client order id checking 2021-06-07 01:07:00 +08:00
c9s
5fd0ab4cd3 skip client order id when no client order is given 2021-06-07 01:03:21 +08:00
c9s
291fdbaf25 optimize max submit order api priority 2021-06-07 01:03:09 +08:00
c9s
f20e809940 types: add bestBidAndAsk method 2021-06-07 01:02:43 +08:00
c9s
e8205556ff show bbgo version name 2021-06-07 00:57:47 +08:00
c9s
b60fd9e356 support: fix quantity formatting 2021-06-07 00:57:47 +08:00
c9s
b9584117d6 add QueryLastFundingRate api to binance exchange 2021-06-01 03:15:19 +08:00
c9s
b5c4fc3e4e fix kline record insert fields 2021-06-01 01:39:23 +08:00
c9s
4bec8984c0 add klines columns 2021-06-01 01:39:23 +08:00
c9s
507ae934c0 compile and update migration package 2021-06-01 01:39:23 +08:00
c9s
f66095eff9 support: add target orders to the orders 2021-06-01 01:39:22 +08:00
c9s
e5db780be8 notify trades and update position 2021-06-01 01:39:22 +08:00
c9s
40c3a5870f support strategy improvements:
- add taker buy base volume ratio option
- add max base asset balance config
- add min quote asset balance config
- record orders and trades
2021-06-01 01:39:22 +08:00
c9s
6a999b2906 kline: show taker buy base volume and taker buy quote volume 2021-06-01 01:39:22 +08:00
c9s
4da7d3b50b fix side effect order type 2021-06-01 01:39:22 +08:00
c9s
bf73def701 binance: embed fixedpoint.Value into binance Balance struct 2021-06-01 01:39:22 +08:00
c9s
e3473572e9 types: add TakerBuyBaseAssetVolume and TakerBuyQuoteAssetVolume fields to kline 2021-06-01 01:39:22 +08:00
c9s
2925a77815 binance: use fixedpoint.Value for parsing floating number string 2021-06-01 01:39:22 +08:00
Jui-Nan Lin
7abd7225e1 fix(ftx): klines should not be empty 2021-05-31 22:56:26 +08:00
c9s
7ff4051c61 binance: fix websocket handshake 2021-05-30 18:20:14 +08:00
c9s
0b935eff4f fix connection lock call 2021-05-30 18:14:22 +08:00
c9s
69e76485c5 xbalance: fix ticker usage 2021-05-30 18:06:31 +08:00
Yo-An Lin
406f592963 Merge pull request #258 from c9s/feature/okex
feature: add okex exchange user data stream and public stream
2021-05-30 16:21:12 +08:00
c9s
8d12c9262f okex: move connection context cancel calls 2021-05-30 15:54:31 +08:00
c9s
d6bd33a682 okex: remove unused code 2021-05-30 15:53:43 +08:00
c9s
d112dbb1a4 binance: check connCancel only when new context is allocated 2021-05-30 15:53:01 +08:00
c9s
f9d4068145 binance: pull out listen key from stream and reduce critical section 2021-05-30 15:51:25 +08:00
c9s
d863766e00 fix quote quantity alignment 2021-05-30 15:51:00 +08:00
c9s
c84d59734c clear all trades before running backtests 2021-05-30 15:25:00 +08:00
c9s
3aa36b5989 refactor and fix backtest for user data stream and market data stream 2021-05-30 15:08:11 +08:00
c9s
38fd5422ab xmaker: use uncovered position 2021-05-30 14:46:48 +08:00
c9s
1a05f6fbd4 okex: pull read timeout and adjust to 30 seconds 2021-05-30 00:32:06 +08:00
c9s
9a68cfd288 xmaker: fix trade checking 2021-05-30 00:11:35 +08:00
c9s
d962dbe542 adjust read timeout 2021-05-29 20:40:47 +08:00
c9s
70284a8c0f xmaker: move notify trade 2021-05-29 01:41:29 +08:00
c9s
3789315214 show accumulated net profit 2021-05-29 01:38:44 +08:00
c9s
df10e175f9 xmaker: fix wording 2021-05-29 01:32:33 +08:00
c9s
e2561bde96 xmaker: add NotifyTrade option 2021-05-29 01:31:13 +08:00
c9s
65a38e56b8 slacknotifier: spawn notify worker as a go routine 2021-05-29 01:30:57 +08:00
c9s
6e0bc7c1e2 xmaker: use trade channel to buffer trades 2021-05-29 01:03:43 +08:00
c9s
33db0b5c6f xmaker: add trade stores for trade buffering 2021-05-29 00:28:13 +08:00
c9s
426a6157af okex: fix ping connection lock 2021-05-29 00:27:28 +08:00
c9s
64b9c78a5b okex: fix order detail segmentation 2021-05-29 00:27:05 +08:00
c9s
2a5ef30135 add ping worker to max 2021-05-29 00:26:53 +08:00
c9s
e11553139e binance: make convert functions private 2021-05-29 00:26:39 +08:00
c9s
8d31435ded add trade store 2021-05-29 00:25:23 +08:00
c9s
f49490f986 fix websocket ping/pong issue 2021-05-28 23:34:21 +08:00
c9s
002b28f75a okex: implement candlestick api and improve kline console format 2021-05-28 20:51:10 +08:00
c9s
5f18b89dfa if publicOnly is set, we should not connect user data stream 2021-05-28 19:01:55 +08:00
c9s
f190b1e66a fix market data stream initialization 2021-05-28 03:17:46 +08:00
c9s
d932a686a0 fix strategy market data stream usage 2021-05-28 03:15:29 +08:00
c9s
4f16f6b1f8 fix market data stream usage 2021-05-28 03:13:50 +08:00
c9s
b430128ba1 okex: fix okex order cancellation 2021-05-28 03:05:59 +08:00
c9s
29304d14ba okex: implement submit orders and cancel order api 2021-05-28 02:45:09 +08:00
c9s
6407eab9c1 okex: convert order details into trades and orders 2021-05-28 02:21:35 +08:00
c9s
19b700dfba okex: parse and convert account information 2021-05-28 01:14:11 +08:00
c9s
777701c0cb add userdatastream cmd for testing private stream 2021-05-28 00:47:34 +08:00
c9s
545d0f18e3 okex: handle kline close event 2021-05-27 18:43:42 +08:00
c9s
2844b7c3a7 okex: add kline command for testing kline data 2021-05-27 18:35:34 +08:00
c9s
76048633cc okex: support websocket candle data 2021-05-27 17:55:23 +08:00
c9s
4fdd9d5097 okex: convert interval to candle types 2021-05-27 17:40:24 +08:00
c9s
1d400e281c okex: convert book data to book snapshot and book update 2021-05-27 16:01:15 +08:00
c9s
884e764fe7 okex: order book parsing 2021-05-27 15:48:51 +08:00
c9s
03431da00c okex: remove private dial method 2021-05-27 15:16:01 +08:00
c9s
f4f4304df6 move Dial method to StandardStream 2021-05-27 15:14:58 +08:00
c9s
7d62a7634b set market data stream to public 2021-05-27 15:11:44 +08:00
c9s
b7c87c7744 core: move market data subscription to market data stream 2021-05-27 15:09:18 +08:00
c9s
45f1a13870 rename Stream field to UserDataStream and add MarketDataStream 2021-05-27 14:45:06 +08:00
c9s
18045bb1e7 Move ReconnectC to the StandardStream 2021-05-27 14:42:14 +08:00
Yo-An Lin
7804415873 Merge pull request #254 from c9s/feature/okex
feature: add okex exchange
2021-05-27 01:28:41 +08:00
Yo-An Lin
930467d9c6 Merge pull request #257 from jnlin/ftx/symbol-map
feat(ftx): use go generate to build symbol map
2021-05-27 01:28:10 +08:00
c9s
8c50ce725c add stream callbacks 2021-05-27 01:07:38 +08:00
c9s
2538824661 okex: implement basic stream 2021-05-27 01:07:25 +08:00
c9s
2381df5009 add okex to the exchange factory 2021-05-27 00:35:51 +08:00
c9s
29ad95a639 add okex to the valid exchange name 2021-05-27 00:29:16 +08:00
c9s
18daf54500 ftx: add LocalSymbol to test 2021-05-27 00:27:46 +08:00
c9s
5becfb99e6 okex: implement query account balance 2021-05-27 00:24:16 +08:00
c9s
859eaf3c2a okex: add trade service function skeletons 2021-05-27 00:05:43 +08:00
c9s
c6c353b29a okex: implement QueryTickers 2021-05-27 00:05:43 +08:00
c9s
c9aa0df054 gensymbols to generate spot symbol map 2021-05-27 00:05:43 +08:00
c9s
d8c6545d2d okex: implement query ticker 2021-05-27 00:05:43 +08:00
c9s
3511bcf13f okex: move go generate to the convert file 2021-05-27 00:05:43 +08:00
c9s
364e6fc990 okex: add local symbol convert function 2021-05-27 00:05:43 +08:00
c9s
016c60796d pull out BNB currency string 2021-05-27 00:05:43 +08:00
c9s
ea78c0308b add LocalSymbol field for exchange specific symbol 2021-05-27 00:05:43 +08:00
c9s
97b377da0a okex: implement query markets 2021-05-27 00:05:43 +08:00
c9s
4ded82c94e pull out types.Exchange interfaces to make it minimal 2021-05-27 00:05:43 +08:00
c9s
c8cb75cabc add funding rate api support 2021-05-27 00:05:43 +08:00
c9s
1fb456d8ad add Stringer interface to fixedpoint 2021-05-27 00:05:43 +08:00
c9s
2bd79bcaf0 okex: add PublicDataService NewGetInstrumentsRequest 2021-05-27 00:05:43 +08:00
c9s
365b4c3837 okex: refactor trade service and fix order details api 2021-05-27 00:05:43 +08:00
c9s
5f8108f93e okex: add GetPendingOrderRequest 2021-05-27 00:05:43 +08:00
c9s
172239ddf6 okex: add order detail request 2021-05-27 00:05:43 +08:00
c9s
7e97163207 okex: implement batch place and batch cancel orders 2021-05-27 00:05:43 +08:00
c9s
1acbaefcd9 okex: implement place order and cancel order requests 2021-05-27 00:05:43 +08:00
c9s
b1aadb4bf0 okex: parse numbers as fixedpoints 2021-05-27 00:05:43 +08:00
c9s
8842208441 okex: add market ticker api support 2021-05-27 00:05:43 +08:00
c9s
e678289577 implement okex balances endpoint 2021-05-27 00:05:43 +08:00
c9s
fe269fd93d okex: implement base rest client 2021-05-27 00:05:43 +08:00
c9s
36071d6649 move MillisecondsJitter to the util package 2021-05-26 23:41:45 +08:00
c9s
9d7f147fbf fix address UnmarshalJSON 2021-05-26 23:37:08 +08:00
c9s
967c7e9f9d xbalance: add withdrawal options 2021-05-26 23:24:05 +08:00
c9s
8781902b68 xmaker: fix stop hedge balance condition 2021-05-26 23:05:41 +08:00
Jui-Nan Lin
72e7915d8d feat(ftx): use go generate to build symbol map 2021-05-26 20:53:51 +08:00
zenix
698ec9911f Fix error formating on depth load fail 2021-05-26 00:57:35 +00:00
zenix
3d2a27fc10 Fix: nil pointer exception in indicator creation, add stoch util func 2021-05-26 00:20:31 +00:00
c9s
9c331063f4 improve depth error messages 2021-05-26 01:31:58 +08:00
c9s
06e982124b fix depth reset 2021-05-26 01:27:42 +08:00
c9s
07ded04a9b fix depth reset 2021-05-26 01:20:24 +08:00
c9s
44ff833c91 binance: buffer depth events 2021-05-26 01:05:12 +08:00
c9s
edeaa597f1 fix loadDepthSnapshot mutex lock issue 2021-05-26 00:58:40 +08:00
c9s
47bf7a1e03 remove time sleep for depthframe 2021-05-26 00:58:40 +08:00
Yo-An Lin
31871143a0 Merge pull request #249 from jnlin/ftx/websocket-kline
Implement kline stream and subaccount feature for FTX exchange
2021-05-26 00:31:35 +08:00
Jui-Nan Lin
1dd397f900 fix(ftx): return original symbol if not found (e.g. BTC-PREP) 2021-05-25 23:29:50 +08:00
Jui-Nan Lin
2e749bb7a8 fix(ftx): always update since to avoid infinite loop 2021-05-25 23:21:38 +08:00
Jui-Nan Lin
bca57e017b fix(ftx): set lastTradeID from options{} to filter trades 2021-05-25 23:14:49 +08:00
Jui-Nan Lin
2fd82ef775 fix(ftx): should use local symbol in fillResponse 2021-05-25 22:43:26 +08:00
Jui-Nan Lin
ab8c1ec18c fix(ftx): allow subaccount to be empty 2021-05-25 22:12:10 +08:00
c9s
686dcef2c5 binance: fix depth snapshot buffering 2021-05-25 21:36:14 +08:00
Jui-Nan Lin
bee3b913f2 fix(ftx): typo 2021-05-25 21:30:15 +08:00
c9s
d3f06bc9d7 fix binance depth stream buffering 2021-05-25 19:13:10 +08:00
Jui-Nan Lin
1318f221b2 fix(ftx): iterate subscription arraywhile polling klines 2021-05-25 18:37:48 +08:00
c9s
bf684c0a5e fix empty bids and ask issues 2021-05-25 15:54:41 +08:00
c9s
28c646a4db reformat code 2021-05-25 01:50:36 +08:00
c9s
c8ca19a298 fixedpoint: fix percentage parsing 2021-05-25 01:36:17 +08:00
Jui-Nan Lin
a7a141c3ea fix(ftx): rename to pollKLines() 2021-05-24 14:21:40 +08:00
Jui-Nan Lin
239d55ce33 fix(ftx): use ID() 2021-05-24 14:18:40 +08:00
Jui-Nan Lin
9226d086b3 fix(ftx/rest): use Id() to make rest requests 2021-05-24 11:20:39 +08:00
Jui-Nan Lin
7fd3375741 fix(ftx/rest): add Id() for setting restful id 2021-05-24 11:19:30 +08:00
Jui-Nan Lin
2467d3fcf6 fix(ftx): get current kline candle in the beginning 2021-05-24 10:22:48 +08:00
Jui-Nan Lin
ddcd0d3969 fix(ftx): send ctx to handleChannelKlineMessage() 2021-05-24 10:16:17 +08:00
Jui-Nan Lin
64387ed2cb Merge branch 'main' into ftx/websocket-kline 2021-05-24 10:01:58 +08:00
Jui-Nan Lin
bd9a61ea97 fix(ftx): use select to handle kline message 2021-05-24 10:00:43 +08:00
Jui-Nan Lin
bbeafab59b fix(ftx): remove unused variables 2021-05-24 09:51:00 +08:00
Jui-Nan Lin
301ed621e6 fix(ftx): use timer.ticker() 2021-05-24 09:45:33 +08:00
Jui-Nan Lin
2394aab32e fix(ftx): start go routine while connecting to ftx websocket 2021-05-24 09:22:47 +08:00
Jui-Nan Lin
02912f362c fix(ftx): subscribe channel first to avoid losing order update 2021-05-24 09:21:49 +08:00
c9s
956ef71a48 use stamp time with milliseconds 2021-05-23 01:29:41 +08:00
c9s
fbe850b364 improve floating number formatting 2021-05-23 01:19:26 +08:00
c9s
117b26840e show net profit margin percentage 2021-05-23 01:17:20 +08:00
c9s
de768296f1 fix rbtree memory error, check neel 2021-05-23 01:12:16 +08:00
c9s
9c70e36e1b save average cost with feeInQuote in the ApproximateAverageCost 2021-05-23 01:05:11 +08:00
c9s
d2e299a68a improve position comment 2021-05-23 00:42:57 +08:00
c9s
9efb45b133 reduce side book copy 2021-05-23 00:42:44 +08:00
c9s
9fa10ee1fd fix rbtree price volume order 2021-05-23 00:42:27 +08:00
c9s
7a653affa6 slice orderbook: do not copy book callbacks 2021-05-23 00:21:57 +08:00
c9s
0061e51dc9 fix rbtree copy depth 2021-05-23 00:21:57 +08:00
なるみ
2052d05bb3 Move Float64Slice to types 2021-05-22 20:20:48 +08:00
c9s
1531f2bb1b fix rbtree insertion and rotation 2021-05-22 18:11:32 +08:00
c9s
9b9643e1f9 improve order cancellation mechanisim 2021-05-22 17:44:20 +08:00
c9s
289227e5f3 add exists method for active book 2021-05-22 17:44:07 +08:00
c9s
0a908e5dda fix position test for net profit 2021-05-22 17:43:53 +08:00
c9s
cca3284140 separate net profit and profit 2021-05-22 17:17:37 +08:00
Yo-An Lin
20f02886de Merge pull request #250 from narumiruna/feature/kd
feature: add stochastic oscillator (KD) indicator
2021-05-22 16:52:46 +08:00
Yo-An Lin
890323c87b Merge pull request #251 from narumiruna/fix/kline-window
fix: KLineWindow
2021-05-22 16:51:53 +08:00
c9s
6df72d54a8 add callbacks 2021-05-22 16:47:34 +08:00
c9s
8acada76a9 replace sliceorderbook with orderbook interface 2021-05-22 16:32:29 +08:00
c9s
cca37d309a fix rbtree iteration 2021-05-22 14:57:14 +08:00
c9s
fd710d533f implement tree copy method 2021-05-22 12:18:08 +08:00
c9s
56b2c8845b fix preorder, postorder and inorder 2021-05-22 11:36:58 +08:00
なるみ
0377a7321e Rename KD to STOCH 2021-05-22 05:52:10 +08:00
なるみ
b9ced0955d Fix test 2021-05-22 05:36:38 +08:00
なるみ
25f76235e9 Fix GetHigh, GetLow and Mid 2021-05-22 05:26:27 +08:00
なるみ
50d96f1276 Fix KLineWindow.Tail 2021-05-22 05:22:38 +08:00
なるみ
ec6cbb05aa Add kd_test.go 2021-05-22 05:00:27 +08:00
なるみ
b82fbbb2ab Add pop, max, min, sum, mean and tail methods to Float64Slice 2021-05-22 03:28:25 +08:00
なるみ
c58e252ff2 Add stochastic oscillator indicator 2021-05-22 03:24:09 +08:00
Jui-Nan Lin
14abd1436b fix(ftx): call EmitConnect() after connected 2021-05-21 23:33:05 +08:00
Jui-Nan Lin
dd0bfab292 fix(ftx): call EmitStart() after connected 2021-05-21 23:25:26 +08:00
Jui-Nan Lin
c7f9352e20 fix(ftx): keep in the loop 2021-05-21 23:10:05 +08:00
Jui-Nan Lin
fb47a4882f fix(ftx): support subaccount in websocket 2021-05-21 23:07:53 +08:00
Jui-Nan Lin
05bde543b7 feat(ftx): emulating kline channel with polling 2021-05-21 23:07:39 +08:00
c9s
09d68057c5 move price volume slice to a separated file 2021-05-21 12:32:47 +08:00
c9s
94fb0e320e implement RBTree orderbook benchmark 2021-05-21 12:31:18 +08:00
c9s
f6229515ac fix color ref 2021-05-21 02:18:45 +08:00
c9s
31f9920ddc fix func comment 2021-05-21 02:17:57 +08:00
c9s
d2003bbc3d remove unused emit function calls 2021-05-21 02:17:40 +08:00
c9s
d930816672 define RBOrderBook 2021-05-21 02:15:31 +08:00
c9s
be646fbac2 move rbtree to types package 2021-05-21 01:44:53 +08:00
c9s
edf8902b28 implement rbtree delete 2021-05-21 01:36:58 +08:00