Commit Graph

3833 Commits

Author SHA1 Message Date
Andy Cheng
6f2eb1688b generalorderexecutor: retry submit/cancel order once 2022-08-11 13:49:16 +08:00
Andy Cheng
df0e527e1e exits/trailingstop: properly works on both long and short positions 2022-08-11 13:36:31 +08:00
ankion
ffd46fd71d binance: fix futures orderTypelimitMaker timeInForce was null 2022-08-11 11:30:00 +08:00
ankion
68a65f1913 binance: fix futures not emit filled event 2022-08-11 10:40:19 +08:00
c9s
e735362efd
cmd/kline: show klines from restful api 2022-08-11 00:08:48 +08:00
c9s
ba87ffab43
max: fix order type casting 2022-08-11 00:00:25 +08:00
c9s
e2df05c054
maxapi: add option to disable user agent header 2022-08-10 23:59:55 +08:00
c9s
8f17d6b019
maxapi: rewrite public service with requestgen 2022-08-10 23:59:50 +08:00
c9s
fc73a12689
maxapi: add get klines request 2022-08-10 23:59:43 +08:00
c9s
6f35aa0f20
maxapi: replace client field type with interface 2022-08-10 23:59:38 +08:00
c9s
c5e93dba00
max: replace client field type with interface 2022-08-10 23:59:25 +08:00
c9s
ae3f6001b9
maxapi/v3: add order type alias 2022-08-10 23:59:21 +08:00
c9s
2380ebb285
maxapi/v3: apply order type constant type 2022-08-10 23:59:16 +08:00
c9s
2f8020efd6
max: add v2 order api back 2022-08-10 23:59:10 +08:00
c9s
3bdc6c7f28
bollmaker: remove unused embedded struct 2022-08-10 23:46:24 +08:00
c9s
677b122964
bbgo: use types.KLineWith for roi take profit 2022-08-10 23:45:21 +08:00
Yo-An Lin
62aff676da
Revert "feature: add smart cancel to drift" 2022-08-09 16:25:36 +08:00
Yo-An Lin
55b4edc595
Merge pull request #853 from zenixls2/feature/smartcancel_drift
feature: add smart cancel to drift
2022-08-09 16:23:33 +08:00
Raphanus Lo
ed975b7ed9
Merge pull request #860 from COLDTURNIP/feature/exchange_order_amount_protection
exchange: order fee-amount protection
2022-08-09 15:01:53 +08:00
c9s
0283f2ad55
bbgo: fix doneTrades lock 2022-08-09 14:52:05 +08:00
zenix
5be6e822e9 fix: highest price and lowest price reset, condition gets crossed 2022-08-09 13:26:56 +09:00
zenix
2c4e03a102 fix: takeProfitFactor NaN 2022-08-09 13:26:56 +09:00
zenix
0e3aecb549 fix: drift pnl calculation and graph drawing, filter periods other than s.Interval and 1m 2022-08-09 13:26:56 +09:00
zenix
9704c09a09 feature: output config to telegram 2022-08-09 13:26:56 +09:00
zenix
45e819ebe7 feature: create simpleinteract and remove command in notification 2022-08-09 13:26:56 +09:00
zenix
4117a83cd1 feature: send photo through telegram, register handler dynamically in strategy, fix canvas rendering 2022-08-09 13:26:56 +09:00
zenix
214e7259ed fix: date parsing in tradingview, feature: enforce trailingstop in drift, add rebalance prototype 2022-08-09 13:26:56 +09:00
zenix
53d4f21c30 feature: add smart cancel to drift 2022-08-09 13:26:56 +09:00
Andy Cheng
ef18791c6a
Merge pull request #865 from andycheng123/fix/protective-stoploss
fix: protectivestoploss not working on long position
2022-08-09 12:15:33 +08:00
Yo-An Lin
072b808a6e
Merge pull request #868 from c9s/fixes
fix: many minor fixes
2022-08-09 12:11:38 +08:00
c9s
9867aa9c68
bbgo: add mutex protection to tradecollector 2022-08-09 11:37:44 +08:00
c9s
2dff1e72da
types: rbtree - add panic check 2022-08-09 11:37:38 +08:00
c9s
4e4ffe83e5
cmd: fix cpu profile starter 2022-08-09 11:37:30 +08:00
c9s
ba7b6f82e2
types: add average price support in order in/out method 2022-08-09 11:37:23 +08:00
c9s
dce64871e8
types: add IsUSDFiatCurrency helper 2022-08-09 11:37:17 +08:00
c9s
99121d19c0
exchange/max: fix order trades query field name 2022-08-09 11:37:12 +08:00
c9s
b4dcdc4031
exchange/max: fix GetOrderTradesRequest order id field 2022-08-09 11:37:05 +08:00
c9s
a5a40c3a42
exchange/max: check order id field 2022-08-09 11:36:59 +08:00
c9s
cba9ffe064
exchange/max: add order trades api 2022-08-09 11:36:53 +08:00
c9s
df4ea9c1e6
types: update ExchangeOrderQueryService interface 2022-08-09 11:36:45 +08:00
c9s
babb0abc95
types: add Out() and Int() methods on SubmitOrder type 2022-08-09 11:36:39 +08:00
c9s
938e612c42
util: move emoji and pnl related functions to util 2022-08-09 11:36:24 +08:00
c9s
f191d3c091
bbgo: make position object optional for trade collector 2022-08-09 11:36:17 +08:00
c9s
cae8bc2882
bbgo: add mutli symbol support to active order book 2022-08-09 11:36:10 +08:00
c9s
f9fe5d7790
cmd: move package import paths 2022-08-09 11:36:02 +08:00
c9s
96b10caa8c
types: add callbacks to the stream order book 2022-08-09 11:35:35 +08:00
austin362667
bb4db871b2 factorzoo: add comments for strategy
factorzoo: add comments for strategy
2022-08-09 00:01:34 +08:00
austin362667
d282568614 factorzoo: add customized indicators 2022-08-08 23:50:42 +08:00
austin362667
bdb04a4322 strategy: factorzoo: refactor to logistic regression
re-format
2022-08-08 20:09:15 +08:00
Andy Cheng
6c2fc3fee0 exits/protectivestoploss: fix shouldStop() 2022-08-08 17:57:05 +08:00
Andy Cheng
5455ae810b strategy/supertrend: only show nterval profit report in backtesting 2022-08-08 17:42:21 +08:00
Andy Cheng
b133767e47 exit/protectivestoploss: works in long position 2022-08-08 16:49:19 +08:00
Andy Cheng
1cd48177ae
Merge pull request #862 from andycheng123/improve/supertrend-strategy
Improve: supertrend strategy
2022-08-08 14:11:49 +08:00
Andy Cheng
c6407e92c8 strategy/supertrend: supertrend indicator adapted new indicator API 2022-08-08 13:07:59 +08:00
Andy Cheng
9d0eecc5bc strategy/supertrend: linreg adapted new indicator API 2022-08-08 12:43:38 +08:00
Raphanus Lo
318590f41b types: rbtree: resolve neel reusing problem 2022-08-08 00:51:37 +08:00
Andy Cheng
737f6e99ba strategy/supertrend: use CalculateQuoteQuantity() in strategy 2022-08-05 16:28:42 +08:00
Andy Cheng
b564e69f82 strategy/supertrend: add CalculateQuoteQuantity() 2022-08-05 15:59:20 +08:00
Andy Cheng
dba1102588 strategy/supertrend: rename AvailableValue() to AvailableQuote() 2022-08-05 15:38:19 +08:00
Andy Cheng
eb57e80119 strategy/supertrend: different qty calculation for spot and leveraged 2022-08-05 15:11:15 +08:00
Andy Cheng
550f2f3fd7 strategy/supertrend: adapt risk.AccountValueCalculator 2022-08-05 11:47:36 +08:00
Andy Cheng
9369ad3155 strategy/supertrend: adapt SetIntervalProfitCollector 2022-08-04 10:39:52 +08:00
Andy Cheng
0d82f32769
Merge pull request #852 from andycheng123/position-updater
feature: PositionModifier
2022-08-03 16:45:02 +08:00
Andy Cheng
e60aae40eb positionModifier: combine callbacks into one 2022-08-03 16:27:05 +08:00
Andy Cheng
5d1bfc6010 strategy/supertrend: add last period accumulated profit report 2022-08-03 15:31:20 +08:00
Andy Cheng
dc9ecdd6ca strategy/supertrend: add accumulated profit SMA report 2022-08-03 14:04:30 +08:00
Yo-An Lin
1b177044fb
Merge pull request #855 from COLDTURNIP/feature/optimizer_hyperparam
optimizeex: hyperparameter optimization tool
2022-08-02 17:38:38 +08:00
Raphanus Lo
d76245cb43 exchange: adjust tests for order fee-amount protection 2022-08-02 15:12:14 +08:00
Raphanus Lo
ed7df4ddbe exchange: order fee-amount protection
Reduce the order amount to prevent submit rejection because of balance exceeding.

  submit_amount = original_amount / (1 + fee_rate)

Currently supported only by FTX Pro.
2022-08-02 13:35:24 +08:00
Raphanus Lo
68af2d0ff8 optimizer: rename optimizeex to hoptimize 2022-08-02 12:44:42 +08:00
Yo-An Lin
609508288c
Merge pull request #856 from COLDTURNIP/fix/ftx_default_fee
exchange: FTX default fee
2022-07-31 13:16:01 +08:00
Raphanus Lo
5ef34a3b61 optimizer: calculate equity diff from whole assets instead of first symbol 2022-07-31 12:52:21 +08:00
Raphanus Lo
bad0aa31b7 optimizer: print best result in the same parameter order defined in config 2022-07-30 23:43:40 +08:00
Raphanus Lo
09940ed3cd optimizer: optimizeEx supports discrete parameters 2022-07-30 20:34:28 +08:00
c9s
55a128ea90
pivotshort: use bbgo notify instead of just info log 2022-07-30 18:14:53 +08:00
c9s
8873101752
pivotshort: move trendEMA log 2022-07-30 18:02:28 +08:00
c9s
adb8a2a713
remove ping / pong debug 2022-07-30 16:27:43 +08:00
c9s
efaf8e9559
pivotshort: add more logs 2022-07-30 13:14:29 +08:00
Raphanus Lo
76d908e2bc optimizer: workaround for data race in TPE optimization 2022-07-30 09:57:15 +08:00
Raphanus Lo
ae3eaaaeb3 optimizer: testing: param config 2022-07-30 00:19:12 +08:00
Raphanus Lo
f5d4fa098d optimizer: refactor selector config types 2022-07-29 23:39:56 +08:00
Raphanus Lo
4e14df443a optimizer: fix typo 2022-07-29 23:33:51 +08:00
Raphanus Lo
23dc8a9ce3 exchange: FTX default fee 2022-07-29 21:49:04 +08:00
Raphanus Lo
67f8b1c32c optimizeex: hyperparameter optimization tool
Currently support the following search algorithms:
- Tree-structured Parzen Estimators (tpe, default)
- Covariance Matrix Adaptation Evolution Strategy (cmaes)
- Quasi-monte carlo sampling based on Sobol sequence (sobol)
- random search (random)

And the following objective function:
- profit
- volume
- equity
2022-07-29 17:09:54 +08:00
c9s
bd754e1714
pivotshort: use infof log 2022-07-29 16:13:57 +08:00
Fredrik
b324149db2 added SideEffectTypeAutoRepay to supportTakeProfit 2022-07-29 09:41:35 +02:00
c9s
a132e789da
bump version to v1.38.0 2022-07-29 14:42:03 +08:00
Andy Cheng
4bc70820c4 positionmodifier: move functions into types.Position 2022-07-29 14:40:54 +08:00
Andy Cheng
9588a6f6bd positionupdater: update command flow 2022-07-29 13:45:33 +08:00
Andy Cheng
2724949678 positionupdater: update avaerage cost 2022-07-29 12:05:39 +08:00
Andy Cheng
32b91b67dd positionupdater: update quote position 2022-07-29 12:00:11 +08:00
Andy Cheng
8c53c7e575 positionupdater: update base position 2022-07-29 11:52:20 +08:00
Yo-An Lin
ae6c6c90a7
Merge pull request #849 from COLDTURNIP/feature/optimizer_output_asset_diff
optimizer: print equity diff in final report
2022-07-28 18:56:41 +08:00
Yo-An Lin
a32ef8ca9a
Merge pull request #850 from COLDTURNIP/feature/optimizer_predict_grid_number
optimizer: calculate total number of grids before testing
2022-07-28 18:54:21 +08:00
zenix
d46267aff9 feature: use ma for tp coefficient, rewrite trailing stop for drift, export all window param to yaml 2022-07-28 19:34:12 +09:00
Raphanus Lo
16814138a1 optimizer: calculate total number of grids before testing 2022-07-28 12:36:44 +08:00
Raphanus Lo
3c0d5727e6 optimizer: print equity diff in final report 2022-07-28 12:31:17 +08:00
c9s
30978ecbd4
pivotshort: check TrendEMA pointer 2022-07-28 11:29:27 +08:00
c9s
d61047cd26
pivotshort: add maxGradient config to trendEMA 2022-07-28 10:27:16 +08:00
c9s
93593ffa06
bbgo: add close position tag log 2022-07-28 10:27:04 +08:00
c9s
a791b455b8
types: fix average profit/loss overflow issue 2022-07-28 10:26:48 +08:00
c9s
5fa2606357
pivotshort: rename kLineClosedStop to fakeBreakStop 2022-07-28 09:29:10 +08:00
c9s
abd99a1d93
types: fix IntervalProfits struct tag 2022-07-27 19:26:16 +08:00
c9s
03541ca746
types: record the position open time 2022-07-27 19:25:30 +08:00
c9s
56bfa22dbe
types: add position openedAt time field 2022-07-27 19:25:30 +08:00
c9s
9f06be14aa
types: calculate MaximumConsecutiveLosses and MaximumConsecutiveProfits 2022-07-27 19:25:29 +08:00
c9s
151d907457
use debug log for trendEMA 2022-07-27 19:22:56 +08:00
c9s
c65456e44b
pivotshort: refactor and add trendEMA to resistance short 2022-07-27 19:22:56 +08:00
c9s
2719c86400
pivotshort: drop unused tail function 2022-07-27 19:22:56 +08:00
c9s
5821dd02cb
pivotshort: fix log format 2022-07-27 19:22:56 +08:00
c9s
9b35c789ee
pivotshort: add total quantity to the notification 2022-07-27 19:22:55 +08:00
c9s
b067c02cf0
pivotshort: fix resistance order quantity calculation 2022-07-27 19:22:55 +08:00
c9s
a9eef3fb93
pivotshort: fix pivot low usage 2022-07-27 19:22:55 +08:00
Yo-An Lin
3aeb6912c9
Merge pull request #846 from c9s/strategy/pivotshort
strategy/pivotshort: refactor breaklow + add fake break stop
2022-07-27 12:18:50 +08:00
c9s
4c6fe11796
pivotshort: rename ClosedKLineStop to fake break stop 2022-07-27 12:04:54 +08:00
c9s
7438798390
bbgo: add ClosedKLineStop trigger 2022-07-27 11:47:12 +08:00
c9s
f323e91a56
pivotshort: fix resistance short 2022-07-27 11:30:32 +08:00
Yo-An Lin
4fd571d712
Merge pull request #813 from zenixls2/feature/drift_study
feature: drift study
2022-07-27 11:29:48 +08:00
zenix
84c7c0596d fix: fix drift naming style, fix kline Copy -> Set 2022-07-27 12:17:33 +09:00
zenix
3f33111182 fix: rename kline Copy to Set 2022-07-27 10:55:15 +09:00
c9s
3fbc634d81
bbgo: narrow down indicator interface type 2022-07-27 02:21:25 +08:00
c9s
feef912930
indicator: pivot low reformat 2022-07-27 01:58:05 +08:00
c9s
ac496e8488
pivotshort: refactor pivot low collector 2022-07-27 01:57:28 +08:00
c9s
b746f801f7
pivotshort: get the correct pivot low value 2022-07-27 01:56:18 +08:00
c9s
854af6b4bd
pivotshort: use new config struct stopEMA and trendEMA 2022-07-27 01:53:53 +08:00
c9s
6f64b6d08e
pivotshort: introduce new config struct 2022-07-27 01:51:47 +08:00
c9s
4fd318701d
indicator: fix slice 2022-07-27 01:43:36 +08:00
c9s
0e18aa68f7
indicator: fix length slice calculation 2022-07-27 01:32:37 +08:00
c9s
5dd14feb42
indicator: fix pivot low indicator 2022-07-27 01:30:43 +08:00
c9s
076f196621
risk: return quantity directly if it's not zero 2022-07-27 01:29:53 +08:00
c9s
578e4b2801
indicator: fix pivot low indicator 2022-07-27 00:58:05 +08:00
zenix
da51bf44c8 fix: rebase error 2022-07-26 20:14:23 +09:00
c9s
2822e39e7b
pivotshort: remove the legacy preloadPivot 2022-07-26 19:00:09 +08:00
c9s
f460a7901d
indicator: refactor macd indicator 2022-07-26 19:00:09 +08:00
c9s
3959e288fd
all: refactor standard indicator helper and fix tests 2022-07-26 18:35:50 +08:00
c9s
0456cdc7a9
bbgo: add hull to the standard indicator 2022-07-26 18:27:22 +08:00
c9s
2459dbd384
indicator: refactor hull indicator 2022-07-26 18:26:52 +08:00
c9s
808d742efc
bbgo: add CCI helper 2022-07-26 18:07:43 +08:00
c9s
f5e64e8e70
bbgo: add ATR, ATRP, EMV to the standard indicator set 2022-07-26 18:07:43 +08:00
c9s
1d6b1de8ba
bbgo: rename standard indicator receiver name 2022-07-26 18:07:43 +08:00
c9s
46afc54559
bbgo: refactor standard indicator set 2022-07-26 18:07:43 +08:00
c9s
94efa8890b
rename inf.go to interface.go 2022-07-26 18:07:43 +08:00
c9s
82673e501b
indicator: fix test cases 2022-07-26 18:07:43 +08:00
c9s
16c62eab2b
indicator/pivotlow: drop the legacy CalculateAndUpdate 2022-07-26 17:33:09 +08:00
c9s
0df321c880
indicator: drop the legacy CalculateAndUpdate for standard indicators 2022-07-26 17:30:41 +08:00
c9s
8bf9b280fc
add low indicator 2022-07-26 17:27:38 +08:00
c9s
eeab328648
indicator: rewrite pivotlow indicator 2022-07-26 17:00:17 +08:00
zenix
85f8b9510d fix: gofmt 2022-07-26 18:00:05 +09:00
zenix
4dd4c5823f fix: unlock lock to get latest price 2022-07-26 18:00:05 +09:00
zenix
2ceb24ad09 fix: panic on image drawing, reduce fee by smoothing the drift curve 2022-07-26 18:00:05 +09:00
zenix
553a55811c fix: buyPrice/sellPrice calculation on one order multiple trades 2022-07-26 18:00:05 +09:00
zenix
d2dee44647 fix: ewma copy 2022-07-26 18:00:05 +09:00
zenix
a8fe20ae3a fix: drift exit condition, trade_stats serialization in redis 2022-07-26 18:00:05 +09:00
zenix
a5039de6aa feature: add omega ratio, print sharpe/omega/interval profit from trade_stats, use stdev for high/low diff for drift to estimate the variance and improve profit, add yaml marshal for dnum fixedpoint 2022-07-26 18:00:05 +09:00
zenix
b6fb5e958d feature: deduct fee from entry, move StopLoss orders cleanup to the begin of close position function 2022-07-26 18:00:05 +09:00
zenix
ac5c7f5773 feature: add pnl / cummulative pnl graph, add continuous graph 2022-07-26 18:00:05 +09:00
zenix
62aac8ecc4 fix: indicator limits 2022-07-26 18:00:05 +09:00
zenix
0d65fe1b8a feature: trailing stop, print mean and modify normalization function of output graph 2022-07-26 18:00:05 +09:00
zenix
c6563aa9bd feature: add stoploss from stopPrice 2022-07-26 18:00:05 +09:00
zenix
9c73aa4adb fix: fine tune drift config. fix atr updating issue 2022-07-26 18:00:05 +09:00
zenix
b52208d7b6 fix: bug in wrong channel subscription in drift 2022-07-26 18:00:05 +09:00
zenix
7368069c7a fix: add persistence to drift 2022-07-26 18:00:05 +09:00
zenix
f2d37650a5 fix: drift bias on long entry position condition, make cancel faster 2022-07-26 18:00:05 +09:00
zenix
55704fdd21 fix: Reverse length, alma comment 2022-07-26 18:00:05 +09:00
zenix
e097421b7b feature: export canvas path for drift strategy. fix exit/entry order and fix missing columns from json parsing 2022-07-26 18:00:05 +09:00
zenix
586f1ff269 fix: clone on sma 2022-07-26 18:00:05 +09:00
zenix
83f8b7a84e fix: logistic regression test case 2022-07-26 18:00:05 +09:00
zenix
7310feb0de fix: highest price normalization in drift strategy 2022-07-26 18:00:05 +09:00
zenix
c51a99400d feature: add plot for series. add autocorrelation. add clone for indicators/series 2022-07-26 18:00:05 +09:00
zenix
69b45e90e9 add drift exit condition 2022-07-26 18:00:05 +09:00
zenix
6a9e00ebd4 fix: update drift strategy 2022-07-26 18:00:05 +09:00
zenix
0ae6b6736c feature: use drift indicator to create basic strategy for study 2022-07-26 18:00:05 +09:00
c9s
44c3e5a6f7
indicator: split pivot low indicator 2022-07-26 16:50:45 +08:00
c9s
5bb1722007
binance: remove ineffected DEBUG_BINANCE_STREAM 2022-07-26 16:26:40 +08:00
c9s
e1e725878e
binance: refactor server time offset setter 2022-07-26 16:25:08 +08:00
c9s
ff61235e70
binance: rename to timeSetterOnce 2022-07-26 16:22:57 +08:00
c9s
cf5e81c848
binance: refactor set server time go routine 2022-07-26 16:22:29 +08:00
zenix
2568a81dfe fix: binance time sync, exchange interval query interface, yaml for fixedpoint 2022-07-26 16:42:34 +09:00
Yo-An Lin
9bf48e9de4
Merge pull request #822 from c9s/fix/api-upgrade
refactor: ewoDgtrd: upgrade order executor api
2022-07-26 14:33:06 +08:00
c9s
8986eeb3a4
bollmaker: apply kline filter closure 2022-07-26 12:08:47 +08:00
c9s
c252a7dcf9
bollmaker: fix log format issue 2022-07-26 12:08:47 +08:00
c9s
d26dd2f1da
bollmaker: remove status change setter 2022-07-26 12:08:47 +08:00
c9s
83c8bc819a
all: drop the legacy smart stops 2022-07-26 12:08:47 +08:00
c9s
c3b6cb80c3
bollmaker: upgrade bollmaker exits methods 2022-07-26 12:08:47 +08:00
c9s
6ae0620730
bollmaker: integrate exits method to bollmaker 2022-07-26 12:08:47 +08:00
c9s
06d71aab4a
types: add doc comment 2022-07-26 11:53:22 +08:00
c9s
ee4fb1a677
add 24hours guard to AddProfit 2022-07-26 11:51:58 +08:00
c9s
9c944d4aba
types: fix profit stats titles 2022-07-26 11:51:24 +08:00
c9s
549e28079b
autoborrow: call Debt() for repay 2022-07-26 11:49:04 +08:00
c9s
bdfb5d08aa
risk: pull out max quantity variable 2022-07-26 11:47:07 +08:00
c9s
9787b867ac
types: call debt() 2022-07-26 11:44:57 +08:00
c9s
79fe49f66f
types: for net() always return total sub debt 2022-07-26 11:44:34 +08:00
c9s
e482a164cf
types: repay debt when closing position 2022-07-25 22:10:02 +08:00
Yo-An Lin
2e7ed9f583
Merge pull request #840 from andycheng123/fix/supertrend-strategy
strategy/supertrend: fix exit methods problem
2022-07-25 15:14:22 +08:00
c9s
0d5d92b26d
pivotshort: fix tail function 2022-07-25 15:02:59 +08:00
Andy Cheng
07959c8862 strategy/supertrend: fix exit methods problem 2022-07-25 14:11:55 +08:00
Yo-An Lin
bfb7dd51d6
Merge pull request #838 from c9s/improve/backtest-json-format
improve: use marshal instead of marshal indent
2022-07-23 12:33:27 +08:00
c9s
4345cef8d7
util: use marshal instead of marshal indent 2022-07-23 12:16:06 +08:00
c9s
a609c0606a
risk: fix margin level prec assertion 2022-07-22 15:06:10 +08:00
c9s
4b7126ce41
risk: add doc comment for MarginLevel method 2022-07-22 14:54:25 +08:00