Commit Graph

1889 Commits

Author SHA1 Message Date
chiahung
18a7520fa7 MINOR: add test for recovery 2023-06-12 17:15:56 +08:00
chiahung
2f050332eb FEATURE: query trades until hard limit or finish filled 2023-06-12 17:15:56 +08:00
chiahung
f38cfb6ea3 REFACTOR: refactor for future test 2023-06-12 17:15:56 +08:00
chiahung
61892eb2df renaming 2023-06-12 17:15:56 +08:00
chiahung
93d35cc423 FEATURE: use TwinOrder to recover 2023-06-12 17:15:56 +08:00
c9s
f6f3293191
xalign: round up requiredQuoteAmount 2023-06-09 11:04:31 +08:00
c9s
8baafdf329
xalign: add DryRun and fix quote amount calculation 2023-06-08 23:15:26 +08:00
c9s
7a6000a316
xalign: fix instanceID 2023-06-08 18:05:58 +08:00
c9s
db43c87227
xalign: load interval from config 2023-06-08 17:02:06 +08:00
c9s
c9ee4e52cc
xalign: add xalign strategy 2023-06-08 17:02:05 +08:00
c9s
0f141c7f79
schedule: add MinBaseBalance config 2023-06-07 16:36:38 +08:00
c9s
e0e27e75bb
schedule: graceful cancel orders before the next submission 2023-06-07 16:30:54 +08:00
c9s
f6a300a7c4
schedule: add useLimitOrder option 2023-06-07 16:27:36 +08:00
Yo-An Lin
c0bb953019
Merge pull request #1185 from c9s/c9s/fix-autoborrow
FIX: [autoborrow] add max borrowable check and add more notifications
2023-06-01 21:24:34 +08:00
c9s
b55fbd5c96
autoborrow: check maxBorrowable 2023-06-01 12:27:39 +08:00
c9s
95e1f10934
autoborrow: send notify when auto repay is skip 2023-06-01 12:18:53 +08:00
c9s
1dfb0cd1a1
autoborrow: notify balance delta event 2023-06-01 12:13:51 +08:00
c9s
f349f3620c
autoborrow: add SlackAttachment support to the binance balance update event 2023-06-01 12:13:22 +08:00
c9s
c9c13b2013
all: replace all Index(i) callers 2023-06-01 07:46:50 +08:00
c9s
5515f588e3
all: add parameter index to the Last method 2023-05-31 19:35:44 +08:00
c9s
ba0102e992
pivotshort: fix find pivot func call 2023-05-31 13:08:21 +08:00
Yo-An Lin
67fe27774c
Merge pull request #1179 from c9s/c9s/refactor-indicator
FEATURE: new indicator API design
2023-05-29 17:06:16 +08:00
c9s
5ef7da8422
grid2: fix precheck 2023-05-26 16:09:07 +08:00
c9s
9fac61351d
all: rename Minus() to Sub() 2023-05-26 15:06:52 +08:00
c9s
648e99f52a
all: refactor and rename indicator.MACD to indicator.MACDLegacy 2023-05-26 15:06:52 +08:00
c9s
273659a870
grid2: update comment 2023-05-26 14:51:06 +08:00
c9s
8c09c9668a
grid2: improve base quote investment check 2023-05-26 14:49:56 +08:00
c9s
f7a5c84768
all: reformat code 2023-05-25 14:01:22 +08:00
c9s
8e426ca4bf
grid2: add last price == sell price case 2023-05-25 13:31:47 +08:00
Yo-An Lin
862848721f
Fix placeSell condition 2023-05-24 17:52:14 +08:00
c9s
26cbd60a66
grid2: add one more test case for base + quote 2023-05-23 17:36:01 +08:00
c9s
1cf788c925
grid2: fix base + quote order placement and add test case 2023-05-23 17:34:03 +08:00
c9s
d5cf53ee94
grid2: fix comparison 2023-05-22 18:20:34 +08:00
c9s
ce2bd7ca7d
grid2: override placeSell if BaseGridNumber is defined 2023-05-22 18:13:51 +08:00
c9s
2046ccc791
grid2: pull out sell boolean var 2023-05-22 18:10:51 +08:00
c9s
0c6ef38ea3
grid2: apply baseGridNumber 2023-05-22 18:08:39 +08:00
c9s
f11d869d02
grid2: sub 1 only when num > 0 2023-05-22 17:26:22 +08:00
c9s
6ae5d2f33a
grid2: round down before the quantity calculation 2023-05-22 17:25:00 +08:00
c9s
a083ec8395
grid2: check numberOfSellOrders == 0 2023-05-22 17:20:16 +08:00
c9s
c93a3d14b3
grid2: round up minBaseQuantity 2023-05-19 16:46:17 +08:00
c9s
4c13171cb0
grid2: add more test for spec 2023-05-19 16:42:26 +08:00
c9s
3a2dbc934b
grid2: add TestStrategy_calculateBaseQuoteInvestmentQuantity test case 2023-05-19 16:37:44 +08:00
c9s
0c4cd7049f
grid2: rewrite the base+quote algo 2023-05-19 15:04:17 +08:00
c9s
86a99b5902
grid2: truncate max base quantity 2023-05-19 13:56:01 +08:00
c9s
17b05b61ba
strategy: fix fastCancel api calls 2023-05-16 16:44:40 +08:00
c9s
027fe9f5e1
drift: adopt the fastOrderExecutor 2023-05-16 16:39:04 +08:00
Andy Cheng
f864cc895c
feature/profitReport: accumulated profit report as a package 2023-05-11 14:54:45 +08:00
Andy Cheng
b148a02491
strategy/supertrend: add net profit 2023-05-08 13:43:25 +08:00
c9s
829edeb401
grid2: improve warning message 2023-04-28 16:16:23 +08:00
c9s
f958120fb5
grid2: remove the len check since we just iterate 2023-04-28 16:12:57 +08:00
c9s
717de67d5a
grid2: improve log and try best to return the order fee 2023-04-28 16:07:03 +08:00
c9s
5a901e929c
grid2: apply defensive programming on the order quantity 2023-04-28 16:02:28 +08:00
c9s
32b2c43198
grid2: emit grid profit after profit stats fix 2023-04-27 00:33:42 +08:00
c9s
46a6d896a2
grid2: improve the if err syntax 2023-04-26 23:48:02 +08:00
c9s
0c72ac2386
grid2: fix typo 2023-04-26 23:37:20 +08:00
c9s
b358cec235
grid2: check if profitStats.Since.IsZero 2023-04-26 23:36:53 +08:00
c9s
f1919a2b43
grid2: check profitStats.Since for the since time range 2023-04-26 23:34:56 +08:00
c9s
2efdee9347
grid2: add timeout context to the fixer 2023-04-26 23:30:09 +08:00
c9s
bd5e98e543
grid2: add more log 2023-04-26 23:07:01 +08:00
c9s
68974bc0b4
grid2: fix profitstats.Since when possible 2023-04-26 22:10:45 +08:00
c9s
55c84e005b
grid2: add one more check for profitStats.InitialOrderID 2023-04-26 22:06:53 +08:00
c9s
77f6c6bb46
bbgo: lock strategy before we sync data 2023-04-26 18:07:29 +08:00
c9s
036bae692e
grid2: move emitGridReady to earlier 2023-04-26 18:07:29 +08:00
c9s
e8a761e331
grid2: add profitFixer and tests 2023-04-26 17:25:31 +08:00
Andy Cheng
4b2c5198fa
strategy/supertrend: add strategy parameter fields in profit report 2023-04-26 10:32:43 +08:00
Yo-An Lin
cd69232156
Merge pull request #1155 from andycheng123/improve/supertrend 2023-04-20 18:48:39 +08:00
Andy Cheng
9f8576bb38
improve/supertrend: different way to calculate order amount for backtesting 2023-04-20 18:37:48 +08:00
Andy Cheng
1fb6e79090
improve/supertrend: fix typo 2023-04-20 18:11:47 +08:00
Andy Cheng
4b8adf6ed5
improve/supertrend: adding opposite position amount to the order amount instead of closing opposite position 2023-04-20 17:53:20 +08:00
chiahung
ed4e0b03e7 add open orders back to active order book if no need to recover 2023-04-18 15:47:00 +08:00
chiahung
d00a91441c FEATURE: move metrics to defer funciton 2023-04-18 15:13:20 +08:00
chiahung
a0aae23bf3 FIX: fix emit ready twice and add error log 2023-04-14 18:30:38 +08:00
c9s
4ab54f586b
grid2: emit grid error when open grid failed 2023-04-14 15:15:28 +08:00
chiahung
6029bd268d update log message 2023-04-07 00:40:32 +08:00
chiahung
cc5ebd5b2c move emit ready and update metrics 2023-04-06 23:57:54 +08:00
c9s
fba73f11ea
grid2: update metrics and trigger ready callback 2023-04-06 23:24:08 +08:00
chiahung
542467245e remove OrderGroupID checking 2023-04-06 18:00:21 +08:00
chiahung
c54507e07f modif log message 2023-04-06 17:53:01 +08:00
chiahung
9fa647ed65 rename method 2023-04-06 16:12:19 +08:00
chiahung
d953a6d7b8 check by trades + open orders 2023-04-06 14:59:03 +08:00
chiahung
00352b2a0d FIX: recover even though inital order id is 0 2023-04-06 11:36:32 +08:00
c9s
4b9e3f2302
xfunding: send positions to slack when start up 2023-03-30 00:46:41 +08:00
c9s
69af9e03ea
xfunding: fix funding fee notification 2023-03-30 00:13:02 +08:00
c9s
6c550c55fa
xfunding: fix spot transfer 2023-03-29 23:09:37 +08:00
c9s
7c975da575
xfunding: fix position sync bug 2023-03-29 23:05:31 +08:00
c9s
0efb56c43e
xfunding: also reset the quote balance transfer 2023-03-29 22:55:40 +08:00
c9s
7e2688b8c7
xfunding: cancel open orders before closing the futures position 2023-03-29 22:54:54 +08:00
c9s
0c9e0649c6
xfunding: use b.MaxWithdrawAmount instead of b.Available 2023-03-29 22:49:34 +08:00
c9s
866443d89f
xfunding: only do transfer when the available balance is not zero 2023-03-29 21:48:10 +08:00
c9s
d0566e23ec
xfunding: log submit failed orders 2023-03-29 21:46:15 +08:00
c9s
1383eb0401
xfunding: resetTransfer should also reset the transfer stats 2023-03-29 21:44:48 +08:00
c9s
117b5198ec
xfunding: introduce resetTransfer method to reset the futures transfer 2023-03-29 21:43:36 +08:00
c9s
a2fdc99741
xfunding: notify position ready 2023-03-29 21:40:18 +08:00
c9s
bc6ee59add
xfunding: refactor transferOut with trade quantity 2023-03-29 21:40:18 +08:00
c9s
088a36a169
xfunding: refactor transferIn 2023-03-29 21:40:18 +08:00
c9s
ce0b73b6e4
xfunding: calculate max minQuantity from spot market and future market 2023-03-29 21:40:18 +08:00
c9s
16cb68ac3e
xfunding: change dust quantity info log to warn log 2023-03-29 21:40:18 +08:00
c9s
0f88309d9e
xfunding: add notifications 2023-03-29 21:40:18 +08:00
c9s
eeda500a90
xfunding: pull out handleAccountUpdate handler 2023-03-29 21:40:17 +08:00
c9s
1e7afbc0c8
xfunding: fix position ready set call 2023-03-29 21:40:16 +08:00
c9s
6f961556d7
xfunding: add SlackAttachment method support on profit stats 2023-03-29 21:39:36 +08:00
c9s
4d59edc3d1
xfunding: add funding fee slack attachment support 2023-03-29 21:39:36 +08:00
c9s
c437837210
xfunding: improve checkAndRestorePositionRisks 2023-03-29 21:36:29 +08:00
c9s
8257c4ffbe
xfunding: fix ClosePosition call for futures 2023-03-29 18:28:25 +08:00
c9s
38778ff756
bbgo: fix order executor ClosePosition for order executor 2023-03-29 17:46:54 +08:00
c9s
38ba567558
xfunding: fix and call FuturesChangeInitialLeverageRequest 2023-03-29 17:14:29 +08:00
c9s
18d8d63b02
binance: add and fix multi assets mode 2023-03-29 16:59:15 +08:00
Yo-An Lin
dc87c79edd
Merge pull request #1132 from c9s/c9s/strategy/funding
strategy: xfunding: add profit stats and collect funding fee info
2023-03-26 15:11:10 +08:00
c9s
88514e8bd9
xfunding: call syncFundingFeeRecords to sync funding fee records 2023-03-26 15:04:12 +08:00
c9s
4d1f691300
xfunding: add syncFundingFeeRecords method 2023-03-26 14:54:27 +08:00
c9s
a3f96871e2
xfunding: pull out newState constructor 2023-03-26 14:44:18 +08:00
c9s
36836c7c79
xfunding: add funding fee time 2023-03-26 14:42:13 +08:00
c9s
e5d2db0f72
xfunding: customize netural position profit 2023-03-26 02:32:21 +08:00
c9s
f4a35132e8
xfunding: add trades to s.NeutralPosition 2023-03-26 02:16:23 +08:00
c9s
ac33b5a878
xfunding: check duplicated funding fee txn 2023-03-26 02:13:22 +08:00
c9s
a6b47fda72
xfunding: check funding fee and record txn id 2023-03-26 02:12:00 +08:00
c9s
ff35fd06c4
xfunding: pull out interval option 2023-03-26 02:09:21 +08:00
c9s
425952d76c
xfunding: log collected funding fee 2023-03-26 01:55:33 +08:00
c9s
ba0dd68be0
xfunding: callcate funding fee 2023-03-26 01:54:39 +08:00
c9s
f127a530b7
xfunding: bind profit stats 2023-03-26 01:33:52 +08:00
c9s
78c73e4514
bbgo: check e.disableNotify for profit stats 2023-03-26 01:32:47 +08:00
c9s
e41df7e321
xfunding: add wip list 2023-03-26 01:21:20 +08:00
c9s
22d339cb41
xfunding: check binance type and return error 2023-03-26 01:16:54 +08:00
c9s
23746678b4
xfunding: initialize NeutralPosition 2023-03-26 01:07:50 +08:00
c9s
5c21445b15
xfunding: comment unused code 2023-03-26 01:03:07 +08:00
c9s
c176e2df5f
xfunding: move moving average config out 2023-03-26 01:02:31 +08:00
Yo-An Lin
e0a9cd3c6d
Merge pull request #1131 from c9s/c9s/strategy/funding
strategy: xfunding: improve sync goroutine, add mutex lock, fix binance websocket message parsing ...
2023-03-25 03:05:46 +08:00
c9s
0c6e9496b3
xfunding: use early return 2023-03-25 02:56:45 +08:00
c9s
300506f9f9
xfunding: fix critical section for usedQuoteInvestment 2023-03-25 02:53:55 +08:00
c9s
0f49f9fbe5
xfunding: add e.AccountUpdate.EventReasonType switch case 2023-03-25 02:48:27 +08:00
Yo-An Lin
cc74156a7d
Merge pull request #1127 from c9s/c9s/strategy/funding
feature: strategy: xfunding
2023-03-24 15:08:28 +08:00
c9s
feec194843
binance: improve transfer logs 2023-03-24 14:37:18 +08:00
c9s
ea7af708f9
add mutex lock 2023-03-24 14:28:36 +08:00
gx578007
cd1314e9e0
Merge pull request #1125 from c9s/bhwu/grid2/using-dnum
FEATURE: [grid2] using dnum
2023-03-24 13:53:35 +08:00
c9s
4669692b8d
xfunding: remove debug log and test code 2023-03-24 03:20:04 +08:00
c9s
1517076f6d
xfunding: implement syncSpotPosition 2023-03-24 03:20:04 +08:00
c9s
0f21c1fd8f
xfunding: fix Warnf format 2023-03-24 03:20:03 +08:00
c9s
84313dbdf9
xfunding: refactor state functions and fix transfer out 2023-03-24 02:52:13 +08:00
c9s
f3049de2ba
all: improve logging 2023-03-24 02:09:49 +08:00
c9s
209fb102fa
xfunding: add stringer support on PremiumIndex 2023-03-24 01:57:43 +08:00
c9s
62e6b232ed
xfunding: refactor and refine PositionState checking 2023-03-24 00:52:36 +08:00
c9s
c1fbbbe400
xfunding: move position state to state struct 2023-03-24 00:36:28 +08:00
c9s
108bb5deeb
xfunding: add guard condition for starting and stopping 2023-03-23 22:58:42 +08:00
c9s
e016892a70
xfunding: pull out startClosingPosition, startOpeningPosition method 2023-03-23 22:57:13 +08:00
c9s
3624dd0338
xfunding: implement close position transfer 2023-03-23 22:54:42 +08:00
c9s
aba80398d9
xfunding: add MinHoldingPeriod support 2023-03-23 22:36:35 +08:00
c9s
a933f90cc8
xfunding: log low funding fee 2023-03-23 18:19:30 +08:00
c9s
b5f69e7f45
xfunding: reset stats when direction changed 2023-03-23 18:18:30 +08:00
c9s
7ba7eb8be7
xfunding: implement reduceFuturesPosition 2023-03-23 18:09:16 +08:00
c9s
1b5126c9a1
xfunding: add mutex 2023-03-23 17:36:30 +08:00
narumi
32c617a283 replenish on start 2023-03-23 16:47:48 +08:00
c9s
44850e48e8
xfunding: add mutex protection 2023-03-23 14:48:24 +08:00
c9s
8b87a8706b
xfunding: add state for recording TotalBaseTransfer 2023-03-23 14:46:02 +08:00
c9s
b7edc38dc7
xfunding: record pending transfer 2023-03-23 13:14:59 +08:00
c9s
16608619ca
xfunding: fix sync guard 2023-03-23 13:07:59 +08:00
c9s
80c30d15a0
xfunding: correct method names 2023-03-23 13:02:22 +08:00
c9s
20cd73e6ad
xfunding: fix transfer and refactoring more methods 2023-03-23 12:58:10 +08:00
c9s
6ca85b175a
xfunding: adjust quote investment according to the fee rate 2023-03-23 00:56:28 +08:00
c9s
6668d683e1
xfunding: adjust quoteInvestment according to the quote balance 2023-03-23 00:40:20 +08:00
c9s
684f6c6e1d
xfunding: document spot trade handler 2023-03-23 00:23:51 +08:00
c9s
928f668fec
xfunding: pull out premium check to detectPremiumIndex 2023-03-22 22:17:37 +08:00
c9s
dc5e0cbcc2
xfunding: solve lint error 2023-03-22 22:15:24 +08:00
c9s
6265ad248e
xfunding: add premium checker 2023-03-22 22:15:01 +08:00
c9s
98b0ffa510
all: add more futures channel types 2023-03-22 22:01:59 +08:00
c9s
e607fc19ac
xfunding: check spotSession, futuresSession names 2023-03-22 21:42:44 +08:00
c9s
d6c430a4b4
xfunding: implement CrossSubscribe 2023-03-22 21:42:06 +08:00
c9s
b881aea228
add position action 2023-03-22 21:38:56 +08:00
c9s
e93d13e425
xfunding: implement CrossRun 2023-03-22 21:36:42 +08:00
c9s
12b9775eb3
rename funding to xfunding 2023-03-22 21:17:33 +08:00
c9s
ab52dd6349
funding: filter kline event with types.KLineWith 2023-03-22 21:11:58 +08:00
gx578007
0e2e8306b4 FEATURE: [grid2] using dnum 2023-03-20 18:00:41 +08:00
chiahung
bc23055536 FEATURE: emit grid error when failed to recover or open grid 2023-03-20 16:27:08 +08:00
narumi
7114016bc9 clamp skew 2023-03-18 23:31:03 +08:00
kbearXD
294c09b9e8
Merge pull request #1119 from c9s/feature/grids/recover-from-trades
FEATURE: make PinOrderMap's key from string to Pin
2023-03-17 10:45:09 +08:00
chiahung
8182840685 use fixedpoint.Value as key 2023-03-16 21:58:41 +08:00
c9s
0b922a929e
grid2: pull out backoff cancel all to cancelAllOrdersUntilSuccessful 2023-03-16 18:01:56 +08:00
chiahung
feabadeb59 FEATURE: make PinOrderMap's key from string to Pin 2023-03-16 17:34:02 +08:00
なるみ
57e3f46c5c
Merge pull request #1117 from c9s/narumi/fixedmaker/atr
strategy: fixedmaker: add option to use ATR to adjust spread ratio
2023-03-16 17:11:13 +08:00
narumi
939427c81f use ATR to adjust spread ratio 2023-03-16 17:03:45 +08:00
chiahung
a5675f72ad MINOR: use Debug config for debug log 2023-03-16 16:44:16 +08:00
なるみ
52b2ffebd1
Merge pull request #1113 from c9s/narumi/fixedmaker/skew
strategy: fixedmaker: add skew to adjust bid/ask price
2023-03-16 02:39:02 +08:00
narumi
cf9a2e55bf add skew to adjust bid/ask price 2023-03-16 02:04:26 +08:00
Yo-An Lin
4ac5a2a9e9
Merge pull request #1115 from c9s/bhwu/fix-correct-price-metrics
FIX: [grid2] fix correct price metrics
2023-03-15 22:10:17 +08:00
gx578007
74c465d943 FIX: [grid2] fix correct price metrics 2023-03-15 21:40:44 +08:00
chiahung
ffdc242f66 use debugOrders 2023-03-15 21:34:04 +08:00
chiahung
f987c85f17 move info log to debug log 2023-03-15 21:12:59 +08:00
chiahung
e686a26dda FEATURE: verify the grids before emit filled orders 2023-03-15 20:15:53 +08:00
narumi
0f9319a2f5 make CreatePositions and CreateProfitStats public 2023-03-15 16:01:13 +08:00
c9s
0882bc4960
bollmaker: log submit order error 2023-03-15 13:26:27 +08:00
なるみ
7d91fd01d8
Merge pull request #1109 from c9s/narumi/rebalance/fix-order-executor-not-found
fix: rebalance: fix positions and profit stats map
2023-03-15 12:25:19 +08:00
Andy Cheng
0a6c41cfe7
fix/bollmaker: fix s.MinProfitActivationRate condition 2023-03-15 11:06:26 +08:00
Andy Cheng
ca4890425c
fix/bollmaker: MinProfitActivationRate is disabled if it's not set 2023-03-15 10:57:18 +08:00
narumi
0458858de0 fix position and profitstats 2023-03-14 19:27:41 +08:00
kbearXD
ee4388406e
Merge pull request #1097 from c9s/feature/grids/recover-from-trades
FEATURE: get filled orders when bbgo down
2023-03-14 15:15:32 +08:00
chiahung
dce1e4c7d4 rename buildSyncOrderMap to SyncOrderMap 2023-03-14 14:35:15 +08:00
なるみ
cddf3570f2
Merge pull request #1104 from c9s/narumi/rebalance/balance
fix: rebalance: adjust max amount by balance
2023-03-14 14:06:31 +08:00
chiahung
9da8c39d2c avoid re-query same order 2023-03-14 13:46:46 +08:00
chiahung
4af8523144 new struct PinOrderMap 2023-03-14 10:47:25 +08:00
chiahung
7af4e3bf8a FEATURE: get filled orders when bbgo down 2023-03-14 10:47:23 +08:00
c9s
60d7d20ced
grid2: fix newline for the message format 2023-03-14 00:29:13 +08:00