Commit Graph

3501 Commits

Author SHA1 Message Date
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
c9s
fa98f3fda2
fix position.IsOpened method
Signed-off-by: c9s <yoanlin93@gmail.com>
2022-06-30 18:29:59 +08:00
c9s
3e6b975c2c
pivotshort: refactor ResistanceShort entry method 2022-06-30 18:29:02 +08:00
c9s
6aa6e57d96
add ema condition to the lower shadow take profit 2022-06-30 17:42:23 +08:00
Andy Cheng
1573a9acf3 strategy/supertrend: add linear regression as filter 2022-06-30 16:35:00 +08:00
c9s
903d773025
dynamic: invert if
Signed-off-by: c9s <yoanlin93@gmail.com>
2022-06-30 15:49:18 +08:00
c9s
b15e8d0ce4
all: refactor exit method set and fix dynamic call/merge
Signed-off-by: c9s <yoanlin93@gmail.com>
2022-06-30 15:49:18 +08:00
c9s
e2ab363e64
dynamic: add CallStructFieldsMethod for map struct field call
Signed-off-by: c9s <yoanlin93@gmail.com>
2022-06-30 15:49:18 +08:00
c9s
527070d13d
all: rewrite and clean up graceful shutdown api 2022-06-30 15:49:18 +08:00
c9s
7d5474e3dd
pivotshort: call MergeStructValues to update the field value 2022-06-30 15:49:18 +08:00
c9s
cf0ca70d24
move and rename isSymbolBasedStrategy 2022-06-30 15:49:18 +08:00
c9s
3013eeccc7
move dynamic stuff to the pkg/dynamic package 2022-06-30 15:49:18 +08:00
c9s
a74decc47d
add more test case for reflect 2022-06-30 15:49:18 +08:00
c9s
fa917b0b77
bbgo: implmenet reflectMergeStructFields so that we can merge field values 2022-06-30 15:49:17 +08:00
c9s
ab3341d5ae
pivotshort: make preload pivot as a pure function 2022-06-30 15:49:17 +08:00
c9s
9733eec280
pivotshort: move pure funcs to the bottom 2022-06-30 15:49:17 +08:00
c9s
38767cd2df
move private methods to the bottom 2022-06-30 15:49:17 +08:00
c9s
ee45f154a1
pivotshort: rename bounce short to resistance short 2022-06-30 15:49:17 +08:00
zenix
0141f81086 refactor: ewo use SeriesExtend 2022-06-29 22:02:50 +09:00
zenix
70f4676340 feature: extend indicators, extend seriesbase methods 2022-06-29 21:49:02 +09:00
zenix
69533c0397 feature: add sharpe function implementation 2022-06-29 20:10:20 +09:00
zenix
d8d77cec1e feature: add skew, covariance and variance 2022-06-29 20:10:20 +09:00
zenix
1e31c4fb04 feature: add correlation for series 2022-06-29 20:10:20 +09:00
zenix
36127a6332 feature: implement omega, sharp, sortino related functions 2022-06-29 20:10:20 +09:00
zenix
b26d3005a3 feature: add pct_change implementation in indicator 2022-06-29 20:10:20 +09:00
Yo-An Lin
ccfaf0e070
Merge pull request #784 from c9s/strategy/pivotshort
strategy: pivotshort: fix stopEMA
2022-06-29 17:04:24 +08:00
c9s
4bb2e4a25f
fix stopEMA range check 2022-06-29 16:59:50 +08:00
Andy Cheng
6222ceef9a
Merge pull request #785 from andycheng123/improve/optimizer-progressbar
optimizer: add progressbar
2022-06-29 16:28:03 +08:00
Andy Cheng
a029509b63 optimizer: add progressbar 2022-06-29 16:17:43 +08:00
c9s
83d6f4764c
types: fix profit factor calculation
Signed-off-by: c9s <yoanlin93@gmail.com>
2022-06-29 15:37:18 +08:00
c9s
84083f56b7
bbgo: add ExchangeSession param to the subscribe method 2022-06-29 15:16:56 +08:00
c9s
cb1c5634a2
pivotshort: remove redundant notification 2022-06-29 15:14:24 +08:00
Zenix
6b6686caa8
Merge pull request #778 from zenixls2/feature/series_extend
feature: add seriesExtend
2022-06-29 12:35:48 +09:00
c9s
38920dfc7a
pivotshort: fix kline history loading 2022-06-29 11:23:05 +08:00
zenix
0b8441f4a2 rename: ToArray -> Array, ToReverseArray -> Reverse 2022-06-29 11:13:43 +09:00
c9s
fc3e76204a
bbgo: add todo for the reflect Subscribe call 2022-06-29 02:03:00 +08:00
c9s
95c2711b0d
bbgo: call Subscribe method dynamically 2022-06-29 02:02:23 +08:00
c9s
16f2a06b1f
all: move exit methods to the bbgo core
Signed-off-by: c9s <yoanlin93@gmail.com>
2022-06-29 01:58:15 +08:00
c9s
cfc4fd1f81
add doc for CumulatedVolumeTakeProfit 2022-06-29 01:39:33 +08:00
c9s
3d4f765678
rename protectionStopLoss to protectiveStopLoss 2022-06-29 01:31:56 +08:00
c9s
37413e4355 pivotshort: fix bounce ratio calculation 2022-06-28 23:47:34 +08:00
c9s
b32cfef2fd backtest: set order price for market order 2022-06-28 23:47:34 +08:00
c9s
609b6a7a50 add ref link to trade stats 2022-06-28 23:47:34 +08:00
c9s
32c76105b0 types: add total net profit field to trade states
Signed-off-by: c9s <yoanlin93@gmail.com>
2022-06-28 23:47:34 +08:00
c9s
1617005114 pivotshort: fix pivotshort trigger condition 2022-06-28 23:47:34 +08:00
zenix
12757a0458 feature: add seriesExtend 2022-06-28 21:11:07 +09:00
c9s
1156e15cfe
backtest: add order cancel test case
Signed-off-by: c9s <yoanlin93@gmail.com>
2022-06-28 18:25:51 +08:00
c9s
c0f8bb9a2d
backtest: do not change the backtest order price
- apply the last price on the executed trade
- add more tests
2022-06-28 17:43:51 +08:00
c9s
81ed5bff4f
backtest: refactor calculateNativeOrderFee and add test case 2022-06-28 15:29:01 +08:00
c9s
abee61cdc4
backtest: fix stop order backtest, add more test cases and assertions 2022-06-28 14:35:06 +08:00
c9s
09e98eed82
backtest: handle stop market and add test case
Signed-off-by: c9s <yoanlin93@gmail.com>
2022-06-27 20:49:55 +08:00
c9s
34900776f6
pivotshort: reformat code 2022-06-27 19:54:58 +08:00
c9s
10d5a8a4f2
backtest: fix stop limit order matching
Signed-off-by: c9s <yoanlin93@gmail.com>
2022-06-27 19:48:14 +08:00