From 4fb61534f821371b7d05ef25cd1284fa0e85f41e Mon Sep 17 00:00:00 2001 From: Siyuan Wang Date: Sat, 24 Feb 2024 23:17:50 +0800 Subject: [PATCH] feat(vendor-ccxt): enable ccxt pro (#469) --- apps/vendor-ccxt/src/index.ts | 10 +++++----- .../changes/@yuants/vendor-ccxt/2024-02-24-15-16.json | 10 ++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 common/changes/@yuants/vendor-ccxt/2024-02-24-15-16.json diff --git a/apps/vendor-ccxt/src/index.ts b/apps/vendor-ccxt/src/index.ts index 5c582d068..2acbc2b65 100644 --- a/apps/vendor-ccxt/src/index.ts +++ b/apps/vendor-ccxt/src/index.ts @@ -67,7 +67,7 @@ interface IGeneralSpecificRelation { }; console.info(formatTime(Date.now()), 'init', EXCHANGE_ID, CCXT_PARAMS); // @ts-ignore - const ex: Exchange = new ccxt[EXCHANGE_ID](CCXT_PARAMS); + const ex: Exchange = new ccxt.pro[EXCHANGE_ID](CCXT_PARAMS); let accountInfoLock = false; @@ -334,7 +334,7 @@ interface IGeneralSpecificRelation { } return ( ex.has['watchTicker'] - ? defer(() => ex.watchTicker(symbol)) + ? defer(() => ex.watchTicker(symbol)).pipe(repeat()) : defer(() => ex.fetchTicker(symbol)).pipe( // repeat({ delay: 1000 }), @@ -387,7 +387,7 @@ interface IGeneralSpecificRelation { } return ( ex.has['watchOHLCV'] - ? defer(() => ex.watchOHLCV(symbol, timeframe)) + ? defer(() => ex.watchOHLCV(symbol, timeframe)).pipe(repeat()) : defer(() => { const since = Date.now() - 3 * period_in_sec * 1000; return ex.fetchOHLCV(symbol, timeframe, since); @@ -424,7 +424,7 @@ interface IGeneralSpecificRelation { mergeMap(() => { const balance$ = ( ex.has['watchBalance'] - ? defer(() => ex.watchBalance()) + ? defer(() => ex.watchBalance()).pipe(repeat()) : defer(() => ex.fetchBalance()).pipe(repeat({ delay: 1000 })) ).pipe( // @@ -432,7 +432,7 @@ interface IGeneralSpecificRelation { ); const positions$ = ( ex.has['watchPositions'] - ? defer(() => ex.watchPositions()) + ? defer(() => ex.watchPositions()).pipe(repeat()) : defer(() => ex.fetchPositions()).pipe( // repeat({ delay: 1000 }), diff --git a/common/changes/@yuants/vendor-ccxt/2024-02-24-15-16.json b/common/changes/@yuants/vendor-ccxt/2024-02-24-15-16.json new file mode 100644 index 000000000..4d3b1dd23 --- /dev/null +++ b/common/changes/@yuants/vendor-ccxt/2024-02-24-15-16.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@yuants/vendor-ccxt", + "comment": "enable ccxt pro", + "type": "patch" + } + ], + "packageName": "@yuants/vendor-ccxt" +} \ No newline at end of file