Commit Graph

3653 Commits

Author SHA1 Message Date
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
c9s
a9f9fc4e5e
risk: add margin level calculator 2022-07-22 14:53:17 +08:00
c9s
b53da177c2
risk: add test case for account calculator 2022-07-22 14:42:30 +08:00
c9s
3cf5175baa
risk: make calculateAccountNetValue public 2022-07-22 13:36:03 +08:00
c9s
a1387bb4dd
risk: move spot condition to the top 2022-07-22 12:04:43 +08:00
c9s
36cfaa924d
risk: move leverage quantity calculation to the risk package 2022-07-22 11:55:24 +08:00
c9s
54affd2f99
pivotshort: quantity calculation -- sub debt 2022-07-22 11:47:48 +08:00
c9s
76def2fe9d
pull out AccountValueCalculator 2022-07-21 19:46:58 +08:00
c9s
15879adf3b
pivotshort: fix trade loss ratio 2022-07-21 13:17:46 +08:00
c9s
88c0f31e87
pivotshort: add trade loss to the quantity calculating 2022-07-21 13:05:46 +08:00
c9s
756fcb4807
pivotshort: fix min leverage protection 2022-07-21 13:04:19 +08:00
c9s
763ae1f62f
bbgo: fix missing var 2022-07-21 12:36:26 +08:00
c9s
1079757833
bbgo: bind market data store to market data stream when allocating new instance 2022-07-21 12:35:38 +08:00
c9s
de62d9dd67
bbgo: fix injection 2022-07-21 12:33:29 +08:00
c9s
c78ba6a539
bbgo: fix strategy struct field injection phase 2022-07-21 12:18:09 +08:00
c9s
b6d0482517
pivotshort: add more logs and check 2022-07-21 12:05:05 +08:00
c9s
ea08a61e28
indicator/stoch: simplify CalculateAndUpdate 2022-07-21 01:35:27 +08:00
c9s
86c1619e50
indicator/stoch: move emitUpdate 2022-07-21 01:35:03 +08:00
c9s
9c89359a5f
indicator/stoch: move endTime check to pushK 2022-07-21 01:34:35 +08:00
c9s
6e043ba129
indicator/till: fix e1 check 2022-07-21 01:33:30 +08:00
c9s
946fb96b03
bbgo: reformat 2022-07-21 01:32:09 +08:00
c9s
02c978b812
bbgo: remove volatility from the standard indicator set 2022-07-21 01:31:42 +08:00
c9s
a821641dcf
indicator/atr: implement LoadK and BindK 2022-07-21 01:27:38 +08:00
c9s
0b9d6939f3
indicator/till: add zero time check 2022-07-21 01:22:28 +08:00
c9s
2523c2261b
indicator/till: refactor CalculateAndUpdate 2022-07-21 01:21:29 +08:00
c9s
9f937f529e
bbgo: refactor standard indicator 2022-07-21 01:05:08 +08:00
c9s
4300e00580
indicator/rma: move endTime update to PushK 2022-07-21 01:05:08 +08:00
Yo-An Lin
ed91fdc915
Merge pull request #831 from c9s/feature/defaulter
feature: api: add strategy defaulter interface
2022-07-19 17:55:24 +08:00
c9s
ea4efccd89
schedule: use general order executor and fix notification message format 2022-07-19 17:38:32 +08:00
c9s
ab83805b34
bbgo: add StrategyShutdown interface 2022-07-19 17:13:35 +08:00
c9s
8af2f2f83f
add defaulter interface 2022-07-19 16:59:56 +08:00
c9s
808ba2fc02
bbgo: make slack-app-token optional 2022-07-19 11:41:49 +08:00
c9s
f72cf9bfff
pivotshort: fix quantity check 2022-07-19 11:25:27 +08:00
c9s
9302474d51
add 1m subscribe to RoiTakeProfit 2022-07-19 11:00:45 +08:00
c9s
a6fc03efe5
bump version to v1.37.0 2022-07-19 09:48:21 +08:00
c9s
29fc58cb18
autoborrow: fix repay amount 2022-07-18 19:14:31 +08:00
Raphanus Lo
13455e4ee1 backtest: resolve data race on index.json 2022-07-17 15:46:55 +08:00
c9s
6e4c28ed1b
disable marketTrade stop 2022-07-17 00:59:35 +08:00
c9s
2d0fbe4b99
fix ProtectiveStopLoss subscribe 2022-07-16 14:45:02 +08:00
Raphanus Lo
620381f64b optimizer: eliminate limitation of number of grid point 2022-07-15 23:01:56 +08:00
c9s
44f3793db8
max: emit debt event and ad ratio event 2022-07-15 13:25:02 +08:00
c9s
26f5f36f7e
backtest: for types.OrderTypeStopMarket, use stop price to simulate the actual price for balance locking 2022-07-14 19:26:04 +08:00
c9s
a370a5e489
pivotshort: fix on start handler 2022-07-14 18:36:28 +08:00
c9s
89ffd94d98
update pivotlow on start 2022-07-14 18:35:58 +08:00
Yo-An Lin
191e00adeb
Merge pull request #827 from c9s/strategy/pivotshort
strategy/pivotshort: improve quantity calculation for margin and futures
2022-07-14 18:16:48 +08:00
c9s
c4332fcac2
pivotshort: add leverage settings 2022-07-14 17:44:33 +08:00
c9s
adb96cac39
pivotshort: check maximum margin leverage 2022-07-14 17:38:11 +08:00
c9s
0284d090d8
all: move getExchangeAttributes 2022-07-14 17:36:16 +08:00
c9s
6c91af2392
pivotshort: improve useQuantityOrBaseBalance 2022-07-14 17:36:03 +08:00
c9s
0ba529cb45
pivotshort: replace orders if the active orders is empty 2022-07-14 16:34:03 +08:00
c9s
8fb216ce52
pivotshort: when resistance order is filled, reset the current resistance price 2022-07-14 16:28:30 +08:00
c9s
dd3bd6a325
indicator: rewrite VWMA calculator 2022-07-14 15:57:17 +08:00
c9s
2ef8ecf3d9
indicator: clean up bollinger band indicator api usage 2022-07-14 14:26:08 +08:00
c9s
a5715c6aee
indicator: rewrite boll indicator with stddev indicator 2022-07-14 14:26:08 +08:00
c9s
975d0d6995
indicator: pull out emit update 2022-07-14 11:36:34 +08:00
c9s
bbf01275cc
indicator/sma: clean CalculateAndUpdate and make cache field private 2022-07-14 11:34:53 +08:00
c9s
7696c9f21e
indicator: improve rma preload 2022-07-14 10:54:46 +08:00
c9s
da4dbf4800
indicator: macd: add link for macd https://school.stockcharts.com/doku.php?id=technical_indicators:macd-histogram 2022-07-14 10:45:22 +08:00
c9s
0b07fb5a83
indicator/macd: drop the legacy func calculateMACD 2022-07-14 10:36:16 +08:00
c9s
a7b7ed6610
rename to KLineClosedEmitter 2022-07-14 10:33:10 +08:00
c9s
77264342ce
indicator: add KLineLoader interface 2022-07-14 10:31:38 +08:00
c9s
cb481c660f
fix all indicators for KLineCalculateUpdater interface 2022-07-14 10:28:53 +08:00
c9s
e6c634690b
indicator: clean up ewma's CalculateAndUpdate 2022-07-14 09:29:54 +08:00
c9s
8d8d9a7c59
indicator/rsi: make update callback field private 2022-07-14 09:18:43 +08:00
c9s
b2538b6960
indicator: make callback field private 2022-07-14 09:18:43 +08:00
c9s
2a3118a086
indicator: clean up and update calculator method names 2022-07-14 09:18:42 +08:00
c9s
c27f416dbc
indicator: canonicalize the CalculateAndUpdate method call
also fix the xmaker boll indicator preloading
2022-07-14 09:18:42 +08:00
c9s
1152fae346
ewoDgtrd: upgrade order executor api 2022-07-14 01:36:02 +08:00
c9s
5bbccacc89
risk: rename func 2022-07-14 00:07:49 +08:00
c9s
c7424479bb
risk: add tests 2022-07-14 00:03:47 +08:00
c9s
8985a7a635
risk: add risk function tests 2022-07-13 23:56:22 +08:00
c9s
7932688aa7
add risk calculator functions 2022-07-13 23:45:47 +08:00
Yo-An Lin
affe46655f
Merge pull request #818 from COLDTURNIP/fix/backtest_correct_final_asset
backtest: correct final asset calculation
2022-07-13 23:02:19 +08:00
Yo-An Lin
01d50496a1
Merge pull request #817 from COLDTURNIP/fix/optimizer_initial_storage
optimizer: prepare database before executing backtests
2022-07-13 23:01:59 +08:00
Raphanus Lo
36bdacf3a3 backtest: correct final asset calculation 2022-07-13 17:20:48 +08:00
Raphanus Lo
4985c760be optimizer: prepare database before executing backtests 2022-07-13 15:28:11 +08:00
Yo-An Lin
b9729b0c4f
Merge pull request #816 from c9s/refactor/backtest-report
strategy/pivotshort: add trendEMA
2022-07-13 13:45:15 +08:00
Yo-An Lin
647182e575
Merge pull request #815 from COLDTURNIP/fix/optimizer_progress_bar_counter
optimizer: correct progress bar counter & ETA calculation
2022-07-13 13:35:34 +08:00
c9s
cecb278aa1
autoborrow: use info logger for the margin level info 2022-07-13 13:34:59 +08:00
Raphanus Lo
363c7b6ef6 optimizer: correct progress bar counter & ETA calculation 2022-07-13 11:44:04 +08:00
zenix
d1689a3b14 fix: add error message on wrong sizeof klines passed in calculateSMA 2022-07-13 12:33:57 +09:00
zenix
4e2adcf29e fix: sma calculation, length, and add test case 2022-07-13 12:28:41 +09:00
c9s
ee163eb441
pivotshort: add trendEMA protection 2022-07-13 11:09:57 +08:00
c9s
f5f6fabe07
pivotshort: add trendEMA and add stopEMA subscribe 2022-07-13 10:49:52 +08:00
Yo-An Lin
8119afbb44
Merge branch 'main' into strategy/pivotshort 2022-07-12 23:38:23 +08:00
c9s
f91e1afe95
atrp: multiple 100 for percentage 2022-07-12 22:54:47 +08:00
c9s
a51f26e3a7
backtest: add gross profit and gross loss fields 2022-07-12 19:50:28 +08:00
c9s
7d232f86b8
remove duplicated dumper close 2022-07-12 19:34:07 +08:00
c9s
24e009f333
backtest: avoid writing same record into the file 2022-07-12 18:46:09 +08:00
c9s
6ce9f6a2b7
fix FilterSimpleArgs 2022-07-12 17:55:15 +08:00
c9s
b521a7cf70
pivotshort: fix resistance price update algo 2022-07-12 17:45:47 +08:00
c9s
da4b35bd31
pivotshort: add 1m subscribe 2022-07-12 17:45:47 +08:00
Yo-An Lin
1ef2c1d668
Merge pull request #811 from andycheng123/fix/supertrend-strategy
strategy/supertrend: fix double dema initialization problem
2022-07-12 13:13:19 +08:00
c9s
28d9aa6820
autoborrow: show margin level when check 2022-07-11 16:26:25 +08:00
c9s
3f15df4c0e
autoborrow: fix repay balance check 2022-07-11 16:22:21 +08:00
c9s
98aaa6ce43
autoborrow: fix repay mech 2022-07-11 16:20:45 +08:00
Andy Cheng
1b5dc309f0 strategy/supertrend: fix double dema initialization problem 2022-07-11 13:37:01 +08:00
c9s
2a9a34ae66
bump version to v1.36.0 2022-07-10 19:08:30 +08:00
c9s
c62aafdf2b
compile and update migration package 2022-07-10 19:08:30 +08:00
Zenix
e633cedd3c
Merge pull request #809 from zenixls2/feature/logistic_regression
feature: logistic regression
2022-07-09 17:27:20 +09:00
Yo-An Lin
eacbd13e6b
Merge pull request #810 from andycheng123/fix/supertrend-strategy 2022-07-08 21:03:01 +08:00
Yo-An Lin
e6d9a8a84a
Merge pull request #808 from c9s/fix/kline-with-filtering 2022-07-08 21:02:28 +08:00
c9s
cc8821bb66
update max order api path 2022-07-08 20:47:51 +08:00
c9s
e9faf34b5e
max: fix balance field for api 2022-07-08 17:28:07 +08:00
c9s
59fcef0b6d
supertrend: avoid using embedded struct on DoubleDema 2022-07-08 17:13:12 +08:00
Andy Cheng
d73d7b4380
Merge branch 'main' into fix/supertrend-strategy 2022-07-08 16:45:26 +08:00
c9s
5bd292d0b2
bbgo: add notify(profit) 2022-07-08 16:43:32 +08:00
Andy Cheng
574e142cf9 strategy/supertrend: use types.IntervalWindow instead of types.Interval 2022-07-08 16:42:31 +08:00
c9s
79b70d4a31
supertrend: fix interval window for exit methods 2022-07-08 16:31:28 +08:00
zenix
0e64a14d7f feature: add entropy, cross entropy, sigmoid, softmax, and logistic regression 2022-07-08 16:58:59 +09:00
c9s
46d6ecc663
fix types.TradeStats usage 2022-07-08 15:44:32 +08:00
c9s
581e4be218
supertrend: clean up and update 2022-07-08 15:41:28 +08:00
c9s
d7f83a45b3
fix: check if interval is empty string 2022-07-08 14:47:36 +08:00
Andy Cheng
f8777752a0
Merge branch 'main' into improve/supertrend-strategy 2022-07-07 10:33:30 +08:00
Yo-An Lin
e778db1f24
Merge pull request #801 from c9s/feature/optimizer-metrics-tsv-format
feature: optimizer: support --tsv option and render tsv output
2022-07-07 06:23:49 +08:00
c9s
ba74e83552
optimizer: show *exec.ExitError 2022-07-07 02:26:39 +08:00
c9s
81560746bd
all: reformat code 2022-07-07 02:26:39 +08:00
c9s
c9859c9238
add more struct field tests 2022-07-07 02:26:39 +08:00
c9s
30deaad079
dynamic: add IterateFields 2022-07-07 02:26:39 +08:00
c9s
3131786c02
bbgo: fix trailing stop binding 2022-07-07 02:26:39 +08:00
c9s
74593720a7
add ExitMethodSet.Bind method 2022-07-07 02:26:39 +08:00
c9s
d2637ce261
trailing stop: apply ClosePosition parameter 2022-07-07 02:26:39 +08:00
c9s
7b7d0690c7
optimizer: support --tsv option and render tsv output 2022-07-07 02:11:52 +08:00
c9s
81e05a3f2c
add more struct field tests 2022-07-06 22:01:35 +08:00
c9s
825022715d
dynamic: add IterateFields 2022-07-06 21:58:26 +08:00
c9s
b3e04a68da
bbgo: fix trailing stop binding 2022-07-06 21:50:38 +08:00
Andy Cheng
c43d4e0b24 strategy/supertrend: func to get order side 2022-07-06 18:11:09 +08:00
Andy Cheng
8aa5b706b6 strategy/supertrend: fix double dema missing interval 2022-07-06 17:05:38 +08:00
Andy Cheng
6c93c42ef6 strategy/supertrend: pull double dema into a single file 2022-07-06 16:45:19 +08:00
Andy Cheng
c62e7bbb58 strategy/supertrend: refactor to smaller functions 2022-07-06 16:26:30 +08:00
c9s
3d9db2786d
add trailing stop to the exit method 2022-07-06 10:56:10 +08:00
c9s
b49f12300c
add long position test for trailing stop
Signed-off-by: c9s <yoanlin93@gmail.com>
2022-07-06 10:54:53 +08:00
c9s
03481000cc
reset activated flag when stop order is submitted
Signed-off-by: c9s <yoanlin93@gmail.com>
2022-07-06 03:09:57 +08:00
c9s
2bc12c0522
add trailing stop and it's test cases with gomock
Signed-off-by: c9s <yoanlin93@gmail.com>
2022-07-06 03:04:01 +08:00
c9s
d140012fd5
fix mockgen command
Signed-off-by: c9s <yoanlin93@gmail.com>
2022-07-06 01:32:05 +08:00
c9s
f329af2c6b
generate mocks for the exchange interface
Signed-off-by: c9s <yoanlin93@gmail.com>
2022-07-06 01:31:12 +08:00
Andy Cheng
2de16ac7d1 strategy/supertrend: fix missing Bind() of DEMA 2022-07-05 17:11:58 +08:00
Andy Cheng
91077ce61d strategy/supertrend: add ExitMethod 2022-07-05 16:55:48 +08:00
Andy Cheng
f0dc9d6147 strategy/supertrend: add TradeStats 2022-07-05 16:30:13 +08:00
Andy Cheng
5b3ba03042 strategy/supertrend: preload indicators 2022-07-05 16:25:02 +08:00
c9s
4de5b0bc9b
add TrailingStop2 2022-07-05 16:10:55 +08:00
Andy Cheng
0a0e5ac4d8 strategy/supertrend: config switch for stop by different signals 2022-07-05 15:59:35 +08:00
c9s
b643b8ed0d
fix LowerShadowTakeProfit kline filter condition 2022-07-05 12:15:31 +08:00
c9s
8ac21fa16e
fix LowerShadowTakeProfit kline filter condition 2022-07-05 12:14:53 +08:00
c9s
193703a9a0
all: use tradeStats constructor 2022-07-05 11:14:50 +08:00
Yo-An Lin
0b4044bbb6
Merge pull request #796 from c9s/strategy/pivotshort
strategy/pivotshort: add supportTakeProfit method
2022-07-04 12:26:32 +08:00
c9s
c258d522e6
backtest: update backtest.Exchange currentTime 2022-07-04 02:38:42 +08:00
c9s
82f9fc139c
backtest: refactor exchange field, clean up startTime and endTime deps 2022-07-04 02:34:46 +08:00
c9s
8fc17f9c0b
backtest: move QueryOrder method 2022-07-04 02:29:18 +08:00
c9s
a31f61736a
backtest: pull out userDataStream to backtestEx.BindUserData 2022-07-04 02:27:29 +08:00
c9s
ecd4df86f9
backtest: assign user data stream to backtest.Exchange before we call EmitStart 2022-07-04 02:21:14 +08:00
c9s
449b2d8220
backtest: fix order update emit binding 2022-07-04 02:20:50 +08:00
c9s
3a37154737
pivotshort: fix supportTakeProfit binding 2022-07-04 02:20:15 +08:00
Yo-An Lin
6fe980a2a3
Merge pull request #793 from LarryLuTW/larry/fix-pnl-market
Fix pnl command
2022-07-04 01:42:32 +08:00
Fredrik
771f578efd optimizer/fix: prevent from crashing if missing SummaryReport 2022-07-03 13:16:41 +02:00
c9s
81f9639c85
pivotshort: bind supportTakeProfit method 2022-07-03 17:22:29 +08:00
c9s
278fbb7b51
pivotshort: fix support take profit method 2022-07-03 17:13:01 +08:00
c9s
74cac6e977
pivotshort: adjust layer price calculation 2022-07-03 15:44:37 +08:00
c9s
a408b20eda
fix resistance price calculation 2022-07-03 15:26:05 +08:00
c9s
1e8ac0d08a
pivotshort: improve price grouping 2022-07-02 18:51:17 +08:00
LarryLuTW
a0e8359d23
add market for calculator 2022-07-02 17:45:24 +08:00
c9s
f940bb8e0a
implement SupportTakeProfit method 2022-07-02 13:21:27 +08:00
c9s
ac1b5e4df4
check market in the NewPositionFromMarket
Signed-off-by: c9s <yoanlin93@gmail.com>
2022-07-02 12:43:57 +08:00
c9s
004e6b0e0b
pivotshort: fix findNextResistancePriceAndPlaceOrders 2022-07-02 00:28:41 +08:00
c9s
f1867b02c3
pivotshort: fix message 2022-07-01 18:10:39 +08:00
c9s
9a11fd59ed
pivotshort: fix open close price compare 2022-07-01 17:43:51 +08:00
c9s
178913dd1b
reformat code 2022-07-01 17:32:59 +08:00
c9s
b158c44b95
fix profit stats notification 2022-07-01 17:32:40 +08:00
c9s
4bb9fb7e1b
fix profit stats wording 2022-07-01 17:32:01 +08:00
c9s
53204f47ea
bollmaker: remove legacy state loading 2022-07-01 17:28:48 +08:00
c9s
04df515aea
pivotshort: clean up and force kline direction 2022-07-01 17:26:45 +08:00
c9s
9374125712
pivotshort: pull out break low logics
Signed-off-by: c9s <yoanlin93@gmail.com>
2022-07-01 17:22:09 +08:00
c9s
7f5e92d1b5
cancel order when shutdown 2022-07-01 16:29:03 +08:00
c9s
c792da2164
pivotshort: improve balance check for margin 2022-07-01 15:41:50 +08:00
c9s
09ba2d31c3
pivortshort: run placeResistanceOrders with margin borrow buy 2022-07-01 15:34:21 +08:00
c9s
1af18a5fac
pivotshort: fix breakLow handle event 2022-07-01 15:30:06 +08:00
c9s
8851e67356
dynamic: add doc comment to CallMatch
Signed-off-by: c9s <yoanlin93@gmail.com>
2022-07-01 13:10:53 +08:00
c9s
910c17a567
dynamic: implement CallWithMatch for dynamic calls
Signed-off-by: c9s <yoanlin93@gmail.com>
2022-07-01 13:09:30 +08:00
c9s
503d851c9d
pivotshort: move resistance short to a single file 2022-07-01 01:24:34 +08:00
c9s
454036b166
use types.KLineWith to wrap callbacks 2022-07-01 01:06:10 +08:00
c9s
a4af4776d2
pivotshort: use active orderbook to maintain the resistance orders 2022-07-01 00:57:19 +08:00