Commit Graph

474 Commits

Author SHA1 Message Date
c9s
35ceda8408
grid2: use newClientOrderID only for max 2023-03-13 21:27:13 +08:00
gx578007
4b540fce88
Merge pull request #1100 from c9s/bhwu/grid2/specify-client-order-id
FIX: [grid2] specify client order id explicitly
2023-03-13 18:51:27 +08:00
gx578007
83ba32bf2f mock SubmitOrders by DoAndReturn 2023-03-13 18:43:52 +08:00
c9s
b050ae4098
grid2: fix log format 2023-03-11 16:03:13 +08:00
gx578007
16b30960cc FIX: [grid2] specify client order id explicitly 2023-03-10 18:29:53 +08:00
c9s
3eae532e13
grid2: init filledOrderIDMap for tests 2023-03-10 17:11:51 +08:00
c9s
c6609927f2
grid2: fix Warn by using Warnf 2023-03-10 17:00:09 +08:00
gx578007
fd2032b825 FIX: [grid2] avoid handling one orderID twice 2023-03-10 16:16:11 +08:00
c9s
df6e58d654
grid2: replace all openOrders query to queryOpenOrdersUntilSuccessful 2023-03-10 13:11:42 +08:00
c9s
89abbeb2d1
grid2: add context to backoffs 2023-03-10 13:10:14 +08:00
c9s
f093c73457
grid2: add queryOpenOrdersUntilSuccessful func 2023-03-10 13:10:14 +08:00
c9s
64e0a169e9
grid2: add debug option 2023-03-10 13:10:14 +08:00
c9s
ccf567fdab
grid2: add ClearDuplicatedPriceOpenOrders option 2023-03-10 13:10:11 +08:00
chiahung
67001fcbb7 new config 'recoverGridByScanningTrades' 2023-03-09 17:53:13 +08:00
chiahung
4288c82e25 FEATURE: recover grids with open orders by querying trades process and its buildPinOrderMap method 2023-03-09 17:10:44 +08:00
gx578007
045c8de2a6 refactor metric function to be separated in terms of lock 2023-03-09 11:26:02 +08:00
gx578007
5988567d09 FEATURE: [grid2] add more metrics and fix metric-related issues 2023-03-08 23:54:21 +08:00
c9s
c860e45c34
grid2: simplify isCompleteGridOrderBook 2023-03-08 16:02:31 +08:00
c9s
a75bc2e590
grid2: add isCompleteGridOrderBook doc comment 2023-03-07 21:42:53 +08:00
c9s
72b6f73cb6
grid2: fix complete grid order book condition 2023-03-07 21:41:16 +08:00
c9s
db119a2218
grid2: update metrics before we re-play orders 2023-03-07 20:01:51 +08:00
c9s
756a3bb43f
grid2: add base round down for buy order 2023-03-07 18:37:45 +08:00
c9s
62eed9605d
grid2: round down quoteQuantity/baseQuantity after the fee reduction 2023-03-07 13:53:14 +08:00
gx578007
f8054459c4 FIX: [grid2] group id should be bound by MaxInt32 2023-03-07 11:54:45 +08:00
gx578007
d4912ed3cd FIX: [grid2] avoid initializing metrics twice 2023-03-06 16:56:40 +08:00
c9s
1dd6f9ef3e
grid2: remove order group cancel 2023-03-06 10:38:45 +08:00
c9s
9f29fbd645
grid2: add order group id to the submitOrder forms 2023-03-05 23:21:28 +08:00
c9s
773b055711
grid2: fix length check 2023-03-05 23:20:17 +08:00
c9s
dfba758e88
grid2: add one more log 2023-03-05 17:55:04 +08:00
c9s
584fae1a53
grid2: fix recover order filtering 2023-03-05 17:41:05 +08:00
c9s
4927dd7f98
grid2: add more logs 2023-03-05 17:34:50 +08:00
c9s
5805f0c7f0
grid2: call cancelWrite before everything 2023-03-05 17:10:11 +08:00
c9s
0f307bba7d
grid2: pull out start process to a function 2023-03-05 17:07:01 +08:00
gx578007
ec0d438f9d FIX: [grid2] fix active orderbook at recovering 2023-03-05 14:29:31 +08:00
c9s
9d1da7c847
grid2: remove outdated comment 2023-03-03 19:21:23 +08:00
c9s
e2435f1fc0
grid2: pass submit orders in one call since we have solved the order store issue 2023-03-03 19:09:53 +08:00
c9s
1a109c118d
grid2: use write context for submitting orders 2023-03-03 19:09:53 +08:00
c9s
3f560b2230
grid2: backoff retry open orders api 2023-03-03 19:09:05 +08:00
c9s
fa395b0d0a
grid2: improve the onStart handler 2023-03-03 19:09:05 +08:00
c9s
0d41f0261a
grid2: rewrite cancel all check loop 2023-03-03 19:09:05 +08:00
c9s
bf4553d767
grid2: add OrderFillDelay option 2023-03-03 14:30:58 +08:00
c9s
ca741f91eb
grid2: add fee currency check for buy order 2023-03-03 14:30:58 +08:00
c9s
9a89237c24
grid2: fix base/quote fee reduction 2023-03-03 14:30:58 +08:00
c9s
bd86a89667
grid2: return fee currency 2023-03-03 13:13:27 +08:00
c9s
5cbc6f191f
grid2: aggregate order fee instead of only base fee 2023-03-03 13:13:27 +08:00
gx578007
bc7a071dbd FIX: add persistence service to environment 2023-03-02 22:42:02 +08:00
c9s
e915825ac6
grid2: defer call grid closed 2023-03-02 18:16:09 +08:00
c9s
c5e2acf0f5
grid2: call Initialize in clean up 2023-03-02 18:08:26 +08:00
c9s
86584b01b9
grid2: fix exchange session field 2023-03-02 18:05:48 +08:00
c9s
5212365d2f
grid2: remove s.ExchangeSession check 2023-03-02 17:40:44 +08:00
c9s
6947c8b104
grid2: improve clean up 2023-03-02 17:33:58 +08:00
c9s
3cb190c2c7
bbgo: apply logger into the order executor 2023-03-02 16:16:14 +08:00
c9s
385a97448d
grid2: add StopIfLessThanMinimalQuoteInvestment doc comment 2023-03-02 15:53:42 +08:00
c9s
11329dffe7
grid2: add StopIfLessThanMinimalQuoteInvestment option 2023-03-02 15:50:10 +08:00
c9s
729d32af70
grid2: add minimal quote investment check error log 2023-03-02 15:14:21 +08:00
c9s
4aa25db3ed
grid2: add one more calculateMinimalQuoteInvestment test case 2023-03-02 14:03:22 +08:00
c9s
1d8df08a74
fixedpoint: fix fixedpoint rounding 2023-03-01 22:21:24 +08:00
c9s
f553ee05a0
grid2: log base fee rounding precision 2023-03-01 21:49:15 +08:00
c9s
b2bbf2d6ca
grid2: add comment to the sync call 2023-03-01 21:09:48 +08:00
c9s
b13efdf30e
grid2: calculate grid profit only when the reverse order is placed 2023-03-01 20:05:35 +08:00
c9s
06eff47058
grid2: improve UseCancelAllOrdersApiWhenClose process 2023-03-01 16:35:09 +08:00
c9s
f82af6e6dd
grid2: use UseCancelAllOrdersApiWhenClose 2023-03-01 16:16:26 +08:00
c9s
98739cc8a1
grid2: avoid using loop iterator var 2023-03-01 15:29:46 +08:00
c9s
04da988639
grid2: check if we have o.AveragePrice, use it for newQuantity 2023-03-01 15:29:46 +08:00
c9s
7eb953093c
grid2: merge baseSellQuantityReduction section 2023-03-01 15:29:46 +08:00
c9s
6fc45e66dd
grid2: for non-compound or earn base mode we should always use the original buy quantity 2023-03-01 15:29:46 +08:00
gx578007
3acb0a0a64
Merge pull request #1066 from c9s/fix/grid2/fee-reduction 2023-02-24 12:56:09 +08:00
c9s
5b903cd4ed
grid2: always round up 2023-02-24 12:46:38 +08:00
c9s
37535e9f3e
grid2: fix fee reduction by rounding 2023-02-24 12:25:23 +08:00
c9s
59ff86e4bb
grid2: fix metrics for tests 2023-02-24 00:44:50 +08:00
c9s
d89d0cf0ff
bbgo: refactor SubmitOrders method for retry 2023-02-23 23:34:26 +08:00
c9s
2a47d390f0
grid2: update grid2 metrics 2023-02-23 22:49:03 +08:00
c9s
5e2add8765
grid2: add the missing metrics update 2023-02-23 22:39:47 +08:00
c9s
b666c8bf40
bbgo: triggering pending order update event ot the handler 2023-02-23 18:08:21 +08:00
c9s
31c9ebf34b
grid2: update metrics after recovering the grid orders 2023-02-23 11:19:10 +08:00
c9s
ef771546e3
grid2: simplify WriteString call 2023-02-22 15:45:33 +08:00
c9s
6dc92bea16
grid2: pass logger entry to debugGrid 2023-02-22 15:16:47 +08:00
c9s
9d218d93ac
grid2: use string builder for debugGrid 2023-02-22 15:11:47 +08:00
c9s
67d84b9716
grid2: sleep 100ms between the recover orders 2023-02-22 01:11:34 +08:00
c9s
9e5717ab83
grid2: sleep 2 seconds to wait for the reverse order to be placed 2023-02-22 01:10:49 +08:00
c9s
bee7b593d2
grid2: fix log index number 2023-02-22 01:08:19 +08:00
c9s
bc98fe3bcc
grid2: fix recover sorting 2023-02-22 00:50:00 +08:00
c9s
03dfb4386e
grid2: simplify and fix calculateMinimalQuoteInvestment 2023-02-21 17:58:11 +08:00
c9s
9c1110fb44
grid2: fix calculateMinimalQuoteInvestment 2023-02-21 17:48:40 +08:00
c9s
0402fddea3
grid2: pull out order filtering 2023-02-21 15:50:25 +08:00
c9s
d53b41f4fd
grid2: use go routine to recover grid to avoid order update delay issue 2023-02-21 01:05:56 +08:00
c9s
08cc99c300
grid2: add recover debug log 2023-02-20 22:25:00 +08:00
c9s
a6047c4840
grid2: implement CleanUp interface 2023-02-20 16:52:39 +08:00
gx578007
85d002eabc FIX: [grid2] fix quote accumulation 2023-02-17 22:52:58 +08:00
c9s
21cdb7afe8
grid2: split SubmitOrders calls 2023-02-17 18:54:47 +08:00
c9s
9d2c742496
grid2: avoid using totalBase when one of quote investment or base investment is defined 2023-02-17 18:35:42 +08:00
c9s
a5e134e98d
grid2: fix calculateMinimalQuoteInvestment tests 2023-02-17 17:33:12 +08:00
c9s
29692b0e1a
grid2: fix MinimalQuoteInvestment check 2023-02-17 17:16:25 +08:00
c9s
56628aca73
grid2: emit grid ready only when there is no error 2023-02-16 22:49:22 +08:00
c9s
55476e4176
grid2: include the order dust for the quote investment calculation 2023-02-16 22:20:34 +08:00
c9s
156da92670
grid2: check used quote balance before we generate the grid order 2023-02-16 21:38:48 +08:00
c9s
2aee3cea59
grid2: emit grid ready once the grid is recovered 2023-02-16 21:33:42 +08:00
c9s
eb4e25c008
grid2: emit grid ready earlier 2023-02-16 18:13:51 +08:00
c9s
f039c97e63
grid2: defer EmitCloseGrid callback earlier 2023-02-16 18:12:08 +08:00
c9s
7ba0e86605
grid2: use setGrid with mutex 2023-02-16 18:11:38 +08:00
c9s
9e3383606e
grid2: add quote quantity test case 2023-02-16 18:11:04 +08:00
c9s
9b69fa5465
grid2: log calculateQuoteInvestmentQuantity result 2023-02-16 14:56:28 +08:00
c9s
fa3106eefa
grid2: set the grid field if there is no missing orders 2023-02-15 22:44:07 +08:00
c9s
a9f1aab4b1
grid2: add user data stream on start log 2023-02-15 22:42:46 +08:00
c9s
62b8863ca6
grid2: fix pin price precision 2023-02-15 22:32:55 +08:00
c9s
9ab4c45727
grid2: remove buildGridPriceMap since we have HasPrice method 2023-02-15 22:17:36 +08:00
c9s
ec8e50822a
grid2: do not place sell order at price[0] 2023-02-15 21:51:22 +08:00
c9s
6dfd18bd49
grid2: run recoverGrid only when user data stream is started 2023-02-15 21:49:25 +08:00
c9s
88116440ba
grid2: define strategy field in the logger entry 2023-02-15 17:38:48 +08:00
c9s
e73081d6ba
grid2: add logFields config 2023-02-15 17:33:07 +08:00
c9s
35bfdfab8d
grid2: fix si index check 2023-02-15 16:51:12 +08:00
c9s
44210bf26a
grid2: adjust test case tick size 2023-02-15 16:05:45 +08:00
c9s
a7e100563a
grid2: add test case 2023-02-15 16:03:24 +08:00
c9s
8ef86858e2
grid2: fix calculateBaseQuoteInvestmentQuantity logging 2023-02-15 15:54:49 +08:00
c9s
276149b378
grid2: improve base+quote logging 2023-02-15 15:49:40 +08:00
c9s
79f9f9c5bb
grid2: pull out quote investment variable 2023-02-15 15:41:35 +08:00
c9s
d1cbc6a9ca
grid2: add one more quote investment test case 2023-02-15 15:41:35 +08:00
c9s
2fecf0dc79
grid2: fix HasPrice 2023-02-15 14:57:21 +08:00
c9s
3bf24d97f0
grid2: add HasPrice test 2023-02-15 14:42:01 +08:00
c9s
26c7e03dc1
grid2: fix balance check 2023-02-14 16:44:59 +08:00
c9s
353c74ef5e
grid2: gridNum can not be zero or one 2023-02-13 16:11:42 +08:00
c9s
3df846d878
grid2: fix quote investment algorithm 2023-02-13 14:06:11 +08:00
c9s
4eca007d3d
grid2: fix upper price buy order issue 2023-02-10 17:51:50 +08:00
c9s
34ab53303a
grid2: fix upper price error 2023-02-10 17:22:19 +08:00
c9s
829704eda3
grid2: remove todo 2023-02-08 16:46:19 +08:00
c9s
abdded8126
grid2: add ClearOpenOrdersIfMismatch 2023-02-08 16:43:25 +08:00
c9s
760fc74187
grid2: expose order group ID field 2023-02-08 16:26:37 +08:00
c9s
e8c69dfaef
grid2: add mutex lock for the grid object field 2023-02-07 01:38:25 +08:00
c9s
06c3f5f79c
grid2: add PlainText method support to GridProfitStats 2023-02-06 16:59:50 +08:00
c9s
3a7be0e2b2
grid2: add closing grid log 2023-02-06 16:31:57 +08:00
c9s
854ac4f8ea
grid2: fix pin price algorithm 2023-02-01 18:56:01 +08:00
c9s
4bf0cb6a0c
grid2: use Round instead of Trunc 2023-02-01 15:48:19 +08:00
c9s
d43acaa17c
grid2: add metrics registration guard 2023-01-31 21:30:58 +08:00
c9s
74daa76e75
grid2: fix grid num calculation 2023-01-16 18:34:08 +08:00
c9s
46eb590a9f
grid2: OpenGrid, CloseGrid 2023-01-12 14:33:09 +08:00
c9s
668bf2d847
grid2: remove strategyInstance since we have custom labels 2023-01-11 00:47:36 +08:00
c9s
0d47afd5fd
grid2: add order side to the metrics label 2023-01-10 21:41:10 +08:00
c9s
75919a0bf1
grid2: reset metricsGridOrderPrices 2023-01-10 21:21:35 +08:00
c9s
857b5d0f30
grid2: integrate prometheus metrics 2023-01-10 20:15:51 +08:00
c9s
c9a70d9897
grid2: add grid callbacks 2022-12-26 18:15:39 +08:00
c9s
d9312abba2
grid2: adjust maxTries to 5 2022-12-26 18:08:36 +08:00
c9s
a4f5d15334
grid2: adjust rollback duration to twice 2022-12-26 18:05:35 +08:00
c9s
2d2d194bda
grid2: fix InstanceID for autoRange 2022-12-26 01:40:59 +08:00
c9s
8af7d6f457
grid2: use initial grid order id to query closed order history 2022-12-26 01:35:37 +08:00
c9s
6444fd5e03
grid2: remove default profit stats 2022-12-26 01:24:56 +08:00
c9s
0a6261b6b9
grid2: split more files 2022-12-26 01:04:17 +08:00
c9s
961725f03c
grid2: support autoRange 2022-12-26 00:56:03 +08:00
c9s
54b4f593ec
grid2: validate upper price and lower price only when autoRange is not given 2022-12-26 00:29:31 +08:00
c9s
579df0cec9
types: add simple duration tests 2022-12-25 16:08:34 +08:00
c9s
f60b4630c5
grid2: add AutoRange parameter 2022-12-24 20:39:11 +08:00
c9s
e0daf9904e
grid2: add recover time range rollback 2022-12-24 17:08:50 +08:00
c9s
cb2d9d7eb2
grid2: fix replayOrderHistory logic 2022-12-24 16:14:39 +08:00
c9s
6b75150983
refactor order related functions into core api 2022-12-24 15:58:02 +08:00
c9s
a46b3fe908
grid2: improve debugGrid func 2022-12-24 14:52:08 +08:00
c9s
8e20a55060
grid2: refactor recover functions to replayOrderHistory and reuse scanMissingPinPrices 2022-12-24 14:48:47 +08:00
c9s
216bdb891f
grid2: skip canceled orders 2022-12-24 01:08:28 +08:00
c9s
3d9b919e24
grid2: fix grid recovering 2022-12-24 00:54:40 +08:00
c9s
8715d0aca9
grid2: prevent infinite loop 2022-12-23 23:50:30 +08:00
c9s
ae20cef8f4
grid2: add scanOrderCreationTimeRange func 2022-12-23 23:41:36 +08:00
c9s
606b4650b3
grid2: add RecoverOrdersWhenStart and fix grid recover logic 2022-12-23 19:15:46 +08:00
c9s
882c56a820
grid2: add RecoverWhenStart option 2022-12-23 17:54:30 +08:00
c9s
8a45fe522e
grid2: pull out session dependency from the recoverGrid method 2022-12-23 16:48:40 +08:00
c9s
c721274adc
grid2: implement scanMissingGridOrders 2022-12-23 15:35:26 +08:00
c9s
c59c8638be
grid2: find lastOrderTime and firstOrderTime range 2022-12-22 13:21:39 +08:00
c9s
441e5d867b
grid2: add todo mark 2022-12-20 17:34:20 +08:00
c9s
f92ba9cbf1
grid2: implement recover func loading 2022-12-20 17:33:53 +08:00
c9s
330be79ec6
grid2: add recoverGrid 2022-12-20 15:56:38 +08:00
c9s
6f2664b03e
grid2: fix test for orderTag 2022-12-19 18:51:39 +08:00
c9s
811be78933
grid2: update log message 2022-12-17 11:57:32 +08:00
c9s
fa73b0e7f7
grid2: add warning message 2022-12-15 19:20:15 +08:00
c9s
bbc47bb63a
grid2: remove todo item 2022-12-15 19:06:34 +08:00
c9s
78f10212b9
grid2: fix base fee format 2022-12-15 18:57:21 +08:00
c9s
fcd7a20b78
bbgo,grid2: add place order error log 2022-12-15 18:54:02 +08:00
c9s
051aa19989
grid2: add newOrderUpdateHandler and send profit to notification 2022-12-15 18:47:45 +08:00
c9s
c2133a1712
grid2: call bbgo sync api to sync profit stats 2022-12-15 18:42:25 +08:00
c9s
1964763f58
grid2: add more logs 2022-12-15 18:41:04 +08:00
c9s
ac8186d43d
grid2: debug submitOrder before sending them to the api 2022-12-15 18:30:28 +08:00
c9s
bc8d7e9968
grid2: add skipSpreadCheck option 2022-12-15 18:09:43 +08:00
c9s
c0598a05f6
grid2: add slack attachment footer 2022-12-15 17:47:34 +08:00
c9s
19478b1fbc
grid2: add profit stats since field 2022-12-15 15:39:48 +08:00
c9s
a7c8da7e88
grid2: add SlackAttachment on profit stats 2022-12-15 15:39:16 +08:00
c9s
7a35a652c3
grid2: add SlackAttachment on grid profit 2022-12-15 15:33:26 +08:00
c9s
a6a4be9878
grid2: sync order tag 2022-12-15 14:58:50 +08:00
c9s
16df170ca3
grid2: pull out order tag 2022-12-15 14:58:50 +08:00
c9s
aa4130ed30
grid2: add PlainText method on GridProfit struct 2022-12-15 14:58:31 +08:00
c9s
532d474564
grid2: pull out processFilledOrder method 2022-12-15 14:57:25 +08:00
c9s
096defc331 add test flag and disable lfs in test 2022-12-09 17:34:24 +08:00
c9s
b515c24505 grid2: add earnBase test case 2022-12-07 14:48:51 +08:00
c9s
120a22f0cd grid2: add compound mode order test 2022-12-07 14:42:06 +08:00
c9s
9d24540826 grid2: add order executor mock for testing reverse order 2022-12-07 14:19:49 +08:00
c9s
9215e401d0 grid2: fix quantity, amount, quoteInvestment validation 2022-12-07 12:29:14 +08:00
c9s
df6187dc98 grid2: remove default fee rate 2022-12-07 12:25:30 +08:00
c9s
489b025702 grid2: refactor check spread 2022-12-07 12:24:52 +08:00
c9s
02bebe8ed1 grid2: use min quantity instead of max quantity 2022-12-07 11:44:22 +08:00
c9s
e1e521cec5 grid2: add comment to the minimal quote investment test 2022-12-06 16:38:12 +08:00
c9s
46d1207adb grid2: fix TestStrategy_checkMinimalQuoteInvestment 2022-12-06 16:37:12 +08:00
c9s
b0381fd927 grid2: pull out debugGridOrders func 2022-12-06 16:35:52 +08:00
c9s
b8e5bf1ddd grid2: add test case for testing checkMinimalQuoteInvestment 2022-12-06 16:09:46 +08:00
c9s
47759236e0 grid2: improve log 2022-12-06 15:57:03 +08:00
c9s
0cf43ffb11 grid2: pull out aggregateTradesQuantity func 2022-12-06 15:57:03 +08:00