Commit Graph

491 Commits

Author SHA1 Message Date
c9s
deb9a29521 support one-time password 2020-12-11 17:07:19 +08:00
c9s
f4ef19e5d6 implement PlainText for telegram bot 2020-12-11 15:58:05 +08:00
c9s
6af88a2a87 add interaction callbacks 2020-12-11 14:40:18 +08:00
c9s
45bc4dc9eb refactor telegram notifier with interaction component 2020-12-11 14:40:04 +08:00
c9s
f595b1ef65 fix compile flag check 2020-12-09 16:13:20 +08:00
c9s
846f463cfc print loaded position 2020-12-08 16:32:39 +08:00
c9s
6b760c72b7 use bot token prefix as the redis store namespace 2020-12-08 16:28:55 +08:00
c9s
03afa060d5 add updateInterval for mirrormaker 2020-12-08 16:01:46 +08:00
c9s
c66b140d90 support duration parse 2020-12-08 16:01:46 +08:00
c9s
fe7495898f check if persistence is configured 2020-12-08 15:09:17 +08:00
c9s
53d7fb5611 support telegram chat user persistence 2020-12-08 15:03:52 +08:00
c9s
a299721a98 improve message layout 2020-12-08 14:41:51 +08:00
c9s
4316f1fada pull out bot initialization 2020-12-08 14:25:30 +08:00
c9s
55cd0c6a6e pull out bot initialization to run 2020-12-08 14:20:49 +08:00
c9s
0222c33330 fix kline tail method 2020-12-08 10:26:20 +08:00
c9s
3aa8d70622 add mirrormaker 2020-12-07 23:04:09 +08:00
c9s
9eaf69388c add fixedpoint json marshaling 2020-12-07 23:03:06 +08:00
c9s
4addf65f64 support memory persistence 2020-12-07 12:03:56 +08:00
c9s
2d98336fb6 implement Persistent API for strategy 2020-12-07 11:44:41 +08:00
c9s
341f735bc3 configure ConfigurePersistence if it's defined 2020-12-07 11:44:41 +08:00
c9s
a01f83ab15 add persistence config and tests 2020-12-07 11:44:41 +08:00
c9s
b843388483 only query subscribed kline intervals 2020-12-07 11:44:23 +08:00
c9s
62a541fb27 rename preload to loadBuildConfig 2020-12-07 11:44:23 +08:00
Che-Chia (David) Chang
1b17cba2eb Merge pull request #67 from c9s/feature/add-telegram-bot-notifier
feature: add telegram bot notifier
2020-12-06 14:12:32 +08:00
David Chang
9f92fcf2e4 chore: rename telegram init to telegram auth 2020-12-06 13:59:47 +08:00
David Chang
58aadd9f45 fix: use correct format for log 2020-12-06 13:47:52 +08:00
David Chang
9e4602cf66 fix: allow upadte telegram chat user with bot command 2020-12-06 13:02:21 +08:00
David Chang
a55cd02e21 feature: add info command 2020-12-06 12:34:43 +08:00
David Chang
f9124aa907 fix: telegram bot send message to correct user 2020-12-06 12:11:27 +08:00
David Chang
7caf986d11 fix: change warning type from user to username 2020-12-05 14:28:48 +08:00
David Chang
c72ef2b31c fix: add missing root cmd flags 2020-12-05 14:25:19 +08:00
David Chang
b2d9bd0312 feature: add telegram bot notifier 2020-12-05 14:20:27 +08:00
c9s
c5d002a0b0 fix market data kline registration 2020-12-05 13:32:41 +08:00
c9s
900f822559 improve and fix ewma calculation 2020-12-05 13:32:41 +08:00
c9s
b188901ed0 fix ewma calculation 2020-12-05 13:32:41 +08:00
c9s
f7a119fa5e remove debug message 2020-12-04 19:15:53 +08:00
c9s
936650d879 rename kline trend to direction 2020-12-04 10:18:51 +08:00
c9s
22771288eb fix sma kline window check 2020-12-03 20:42:26 +08:00
c9s
177607e5fb fix ewma kline window check 2020-12-03 20:42:00 +08:00
c9s
f4aee5234a add updater to indicators 2020-12-03 18:14:16 +08:00
c9s
17fd6a405b add StopPriceRatio support 2020-12-03 09:50:36 +08:00
c9s
19d76928fd support movingstop by BalancePercentage 2020-12-03 09:41:41 +08:00
c9s
ef03c0cf20 separate Run and CrossRun
so that we mount one strategy as cross strategy or single exchange strategy
2020-12-03 09:31:40 +08:00
c9s
d60a82256d types: remove slice preallocated cap 2020-12-03 09:27:05 +08:00
c9s
2b264905f9 add warnings and fix subscription 2020-12-03 09:26:10 +08:00
c9s
4f399ebb9f fix stop price formating 2020-12-03 09:25:47 +08:00
c9s
17590fcc08 include movingstop in builtin 2020-12-03 08:52:43 +08:00
c9s
9d7aa2fe22 add movingstop strategy 2020-12-03 08:52:32 +08:00
c9s
0a5bac803c ignore duplicated trade 2020-12-03 08:51:57 +08:00
c9s
edb22383c7 fix ToGlobalOrder call 2020-12-02 22:44:57 +08:00
c9s
d38b16fb3e fix cross exchange strategy subscription 2020-12-02 22:44:41 +08:00
c9s
4cf5929cac improve trade parsing error 2020-12-02 22:21:13 +08:00
c9s
d226ec2e01 change field names to lower case so that we can use shorter name for the accessors 2020-12-02 22:21:13 +08:00
c9s
e57b9f235b add quota 2020-11-23 16:47:36 +08:00
c9s
db6c90b8dd cmd: fix run command signal handling 2020-11-23 16:36:03 +08:00
c9s
a86078d68c max: fix tick size 2020-11-22 21:34:05 +08:00
c9s
914d5cdc94 try to keep all orders from order store 2020-11-17 15:53:46 +08:00
c9s
c40982164a fix trade slack formatting 2020-11-17 15:48:18 +08:00
c9s
8f5491d818 improve balance printing 2020-11-17 14:45:27 +08:00
c9s
18d9245b06 improve order slice lock 2020-11-17 14:31:18 +08:00
c9s
ed6d6342e7 fix account currency translation 2020-11-17 14:24:26 +08:00
c9s
95b0910a09 fix trade order id parsing 2020-11-17 14:13:37 +08:00
c9s
03d99a4cab remove debug logs 2020-11-17 13:25:59 +08:00
c9s
4bda1fee08 fix order id parsing 2020-11-17 12:46:55 +08:00
c9s
cc3da5b678 pass order id for order store exists 2020-11-17 08:53:22 +08:00
c9s
f4512f031c improve cross exchange strategy mounting behavior and add fixedpoint atomic ops 2020-11-17 08:19:22 +08:00
c9s
3ea2e877ff do not submit subscribe request if param array is empty 2020-11-15 13:32:46 +08:00
c9s
ded970f5a4 imporve CrossExchange subscription handling 2020-11-15 13:27:33 +08:00
c9s
94aaaf21b0 improve wrapper binary invocation 2020-11-15 13:23:26 +08:00
c9s
e8b5379202 bollgrid: add warn messages 2020-11-12 17:41:28 +08:00
c9s
2b6547df47 bollgrid: add profit orderbook for bolling grid 2020-11-12 17:38:13 +08:00
c9s
cd283f2c28 remove unused logger field 2020-11-12 17:30:21 +08:00
c9s
1a6f5b99ae bollgrid: submit orders on connect 2020-11-12 16:31:09 +08:00
c9s
8cc1c589a1 fix waitgroup counting 2020-11-12 14:59:47 +08:00
c9s
fc9409673f add graceful shutdown 2020-11-12 14:50:21 +08:00
c9s
af8826a9e4 improve messages 2020-11-12 08:30:57 +08:00
c9s
6740541bcd improve bollgrid 2020-11-12 08:28:59 +08:00
c9s
35a5b61f60 add local active orderbook callback files 2020-11-11 23:19:16 +08:00
c9s
0264baa922 refactor and improve bollgrid 2020-11-11 23:18:53 +08:00
c9s
3912de235b rename baseQuantity to just quantity 2020-11-11 17:55:44 +08:00
c9s
b2cd595069 grid: rename baseQuantity to just quantity 2020-11-11 17:55:16 +08:00
c9s
4bb5730cea remove backtest flag from the sync command 2020-11-11 16:11:41 +08:00
c9s
24e5911140 refactory sync mode into the backtest command 2020-11-11 16:08:24 +08:00
c9s
097b2d30a6 add base-asset-baseline flag for backtest 2020-11-11 14:39:33 +08:00
c9s
04f6da3cb8 add traditional grid strategy 2020-11-10 19:06:20 +08:00
c9s
4ab402a188 clean up legacy code 2020-11-10 16:56:30 +08:00
c9s
04a7c7a2cc add stddev accessor 2020-11-10 16:55:35 +08:00
c9s
23c19c5968 use fixedpoint for balances 2020-11-10 14:19:33 +08:00
c9s
cdf7959029 fix fixedpoint unmarshal 2020-11-10 14:19:22 +08:00
c9s
923fea0d94 improve backtest cmd 2020-11-10 14:19:11 +08:00
c9s
941c93794c fix grid strategy for backtesting 2020-11-10 14:18:54 +08:00
c9s
770efeed4f pnl format improve 2020-11-10 14:18:27 +08:00
c9s
69a33b6400 fix and improve backtest 2020-11-10 14:18:04 +08:00
c9s
f5b17193c5 move verbose flag detection before we setup the environment 2020-11-09 16:49:03 +08:00
c9s
6c2aef31a3 improve backtest logging 2020-11-09 16:47:29 +08:00
c9s
e7cc79f3cf replace errors.Errorf with fmt.Errorf 2020-11-09 16:34:35 +08:00
c9s
1e129e4c86 collect error object instead of logging 2020-11-09 15:29:40 +08:00
c9s
8414f406bf drop the legacy order executor 2020-11-09 15:02:12 +08:00
c9s
4a2a542222 refactor basic risk controller 2020-11-09 14:56:54 +08:00
c9s
ded89e099f refactor simple price matching 2020-11-09 03:17:02 +08:00
c9s
5cc9506960 simplify executeTrade method since we should not use over locked funds 2020-11-09 03:09:12 +08:00
c9s
443f2c6891 document fee rate for BNB holders 2020-11-09 03:01:40 +08:00
c9s
377f4cae34 add account balance lock and unlock for testing maker strategies 2020-11-09 02:58:46 +08:00
c9s
5d4680e496 add lock and unlock functions 2020-11-09 01:10:14 +08:00
c9s
f69c87b3a8 fix fee calculation and add account balance checking 2020-11-08 21:52:44 +08:00
c9s
090011da9e pull out order matching trigger from the kline event callbacks 2020-11-08 13:07:45 +08:00
c9s
e3a1184d22 fix backtest sync exchange and consider fee rate 2020-11-08 12:47:14 +08:00
c9s
6bd3573287 add exchange field in the table so that we can reuse the kline objects for backtest 2020-11-08 12:13:34 +08:00
c9s
4b0bab31fb Merge branch 'feature/backtest' into main 2020-11-07 20:34:55 +08:00
c9s
641784e1b1 calculate pnl after the backtest 2020-11-07 20:34:34 +08:00
c9s
f3571b9832 fix tests 2020-11-07 20:18:11 +08:00
c9s
6040c69327 add sync flag for backtesting 2020-11-07 20:14:53 +08:00
c9s
f1db12eb10 add done channel for backtest exchange 2020-11-07 20:11:07 +08:00
c9s
a4a9067c6a integrate matching engine with backtest exchange 2020-11-07 19:57:36 +08:00
c9s
5be4aa53db move simple price matching to matching.go 2020-11-07 16:09:21 +08:00
c9s
3778adc8c8 implement SimplePriceMatching engine 2020-11-07 16:08:20 +08:00
c9s
0d8fa08171 add book Update method 2020-11-07 15:07:06 +08:00
c9s
1e925cac6e move onConnect to the standard stream 2020-11-07 12:38:57 +08:00
c9s
94bb7f5dac max: fix order symbol convertion 2020-11-07 12:19:57 +08:00
c9s
573a082391 add flashcrash strategy 2020-11-07 12:02:15 +08:00
c9s
b13a2deec5 emit klines and setup account balances 2020-11-07 03:18:05 +08:00
c9s
22a214328d implement backtest command, stream and add backtest config 2020-11-07 02:57:50 +08:00
c9s
8823a39fc2 support backtesting kline verification 2020-11-07 00:49:17 +08:00
c9s
555fe57341 implement kline sync function from command 2020-11-06 21:40:48 +08:00
c9s
f78fefb3b0 implement QueryCh on kline service 2020-11-06 20:58:45 +08:00
c9s
78d7c71ecc add kline service and extend kline struct fields 2020-11-06 19:07:07 +08:00
c9s
c9f2a1aed5 add db tag to kline struct 2020-11-06 11:08:31 +08:00
c9s
5bdf5e0034 remove goroutine from the strategy 2020-11-06 11:01:19 +08:00
c9s
b86b74effb fix max kline parsing 2020-11-05 15:04:56 +08:00
c9s
c54c0788ab rewrite grid strategy trigger 2020-11-05 14:27:22 +08:00
c9s
b38d0d15ed fix order sync for max 2020-11-05 14:12:19 +08:00
c9s
7e47f754c5 use channel to sync trades 2020-11-05 13:35:04 +08:00
c9s
8693bbbd24 fix orderId-based query for binance 2020-11-05 11:14:14 +08:00
c9s
7fab2e24de improve order persistence and support order data sync 2020-11-05 11:14:14 +08:00
c9s
a4555a2b7b implement QueryClosedOrders 2020-11-05 11:14:14 +08:00
c9s
fe16f9aa4d add is_working column 2020-11-05 11:14:14 +08:00
c9s
bb0ff263c8 assign order_id to the trade object 2020-11-05 11:14:14 +08:00
c9s
eb67fc0f8f make mysql-url optional for run command 2020-11-05 11:14:14 +08:00
c9s
f223940b69 add db tags 2020-11-05 11:14:14 +08:00
c9s
8388f443a9 move active order book to the bbgo package 2020-11-05 11:14:14 +08:00
c9s
8e0b5d11a7 add max grid config and fix max price formatting 2020-10-31 20:38:20 +08:00
c9s
14abe3fb7e pull out active order book to the types package 2020-10-31 20:38:20 +08:00
c9s
1eb263de23 use AnyFilled to simplify the order management in the strategy 2020-10-31 20:38:20 +08:00
c9s
e264257d23 implement OrderMap and SyncOrderMap 2020-10-31 20:38:20 +08:00
c9s
2397acd45f fix type casting and assertion by passing pointer 2020-10-31 18:35:48 +08:00
c9s
0f8e9f6df7 add doc comment to Notifiability 2020-10-31 18:35:48 +08:00
c9s
eb05620f99 use Notifiability directly from environment 2020-10-31 18:35:48 +08:00
c9s
49ff9c4dd6 drop legacy trade reporter 2020-10-31 18:35:48 +08:00
c9s
c4d7476212 add submit order routing 2020-10-31 18:35:48 +08:00
c9s
ec9b5230aa refactor trade report and move trade reporter to the environment layer 2020-10-31 18:35:48 +08:00
c9s
8867ceb951 initialize Notifiability for exchange session 2020-10-31 18:35:48 +08:00
c9s
a60207db2a only re-submit the order when the order is filled on the opposite side 2020-10-31 18:33:04 +08:00
c9s
8174b64e21 handle max order update message convertion 2020-10-31 18:29:58 +08:00
c9s
458fa8aa9d add types.OrderStatusFilled 2020-10-31 18:29:58 +08:00
c9s
63df07b815 fix MAX market min price format 2020-10-31 18:29:58 +08:00
c9s
dc547aa818 fix BOLL map allocation 2020-10-31 18:29:58 +08:00
c9s
01699f7268 fix price format 2020-10-31 18:29:58 +08:00
c9s
17a2f74add finalize grid strategy 2020-10-31 18:29:58 +08:00
c9s
9c46ef17b2 handle order update 2020-10-31 18:29:58 +08:00
c9s
551fa4b7fb add grid to built-ins 2020-10-31 18:29:58 +08:00
c9s
60b78979dc fix order id parsing (seems case insensitive) 2020-10-31 18:29:58 +08:00
c9s
c3961024cf implement grid strategy update orders method 2020-10-31 18:29:58 +08:00
c9s
74a9cae38e rename trade callbacks to trade update callbacks 2020-10-31 18:29:58 +08:00
c9s
224acd0ca9 add accessors for last up band and down band values 2020-10-31 18:29:58 +08:00
c9s
e60127090b add GetBOLL access to standard indicator sets 2020-10-31 18:29:58 +08:00
c9s
d49b2be543 add bollinger indicator 2020-10-29 17:51:20 +08:00
c9s
f0681177f9 inject market into the skeleton strategy 2020-10-29 17:06:34 +08:00
c9s
4afabd92ed clean up code 2020-10-29 17:05:01 +08:00
c9s
b0cc128b79 pull out trend types 2020-10-29 17:03:36 +08:00
c9s
a7325e86f0 document swing strategy 2020-10-29 13:42:53 +08:00
c9s
5f45d18ae2 fix struct composition 2020-10-29 13:08:33 +08:00
c9s
19b600bb35 simplify strategy registration api 2020-10-29 07:54:59 +08:00
c9s
c71f013916 let SMA indicator and EWMA indicator use IntervalWindow type 2020-10-29 07:51:23 +08:00
c9s
2f8bffeaca add strict injection check fo pointer only objects 2020-10-29 07:49:06 +08:00
c9s
33257c591e refactor swing strategy with types IntervalWindow 2020-10-29 07:44:22 +08:00
c9s
6d8ec7894e refactor standard indicator set with store 2020-10-29 07:40:02 +08:00
c9s
b1cf9db879 add reflink 2020-10-28 17:50:47 +08:00
c9s
d6553a1155 move strategy subscribe out 2020-10-28 17:49:49 +08:00
c9s
f4474c6a6d add check for sma caluclation 2020-10-28 17:48:16 +08:00
c9s
67446670ac finalize swing strategy and fix trade reporter issue 2020-10-28 17:48:16 +08:00
c9s
c96845ff6a add fields to slack notifier logs 2020-10-28 17:48:16 +08:00
c9s
b22e0370b3 drop legacy OrderProcessor and remove slack debug 2020-10-28 17:48:16 +08:00
c9s
468864302e fix submit order quantity formatting 2020-10-28 17:48:16 +08:00
c9s
2680ad5072 refactor environment, market data store, injection and add swing strategy 2020-10-28 17:48:16 +08:00
c9s
7d7d2c2fc7 assign standard indicator set to the session 2020-10-28 11:15:50 +08:00
c9s
e2df24f31c support standard indicatorset 2020-10-28 09:43:19 +08:00
c9s
50693ae845 implement ewma and sma 2020-10-28 09:13:57 +08:00
c9s
388346b284 move injectStrategyField to a single file 2020-10-27 20:42:48 +08:00
c9s
008e5c83f9 fix notification config check 2020-10-27 20:41:08 +08:00
c9s
e1c2f7cc3d improve notifier signatures and fix slack Notify method 2020-10-27 20:13:10 +08:00
c9s
7905ba09d4 pull out fillStrategyNotifiability 2020-10-27 19:37:11 +08:00
c9s
ccc381143d support pointer type filling 2020-10-27 19:33:11 +08:00
Yo-An Lin
1e5327a5e4 Update strategy.go 2020-10-27 15:51:36 +08:00
c9s
b3eaf832af Add pricealert strategy for demonstrating notification 2020-10-27 13:54:39 +08:00
c9s
ab43de3efd clean up comment for base order executor 2020-10-27 10:00:41 +08:00
c9s
ef598c3a0f assign base order executor descendingly 2020-10-27 09:58:21 +08:00
c9s
8453e95300 configure channel routers 2020-10-27 09:38:29 +08:00
c9s
42f947506c add route methods on Notifiability 2020-10-27 09:24:59 +08:00
c9s
ea05d998f2 load notification conf 2020-10-27 08:57:00 +08:00
c9s
c315b79bd7 add notification config 2020-10-27 08:48:47 +08:00