Skip to content

Commit

Permalink
feat(vendor-ccxt): enable ccxt pro (#469)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thrimbda authored Feb 24, 2024
1 parent add6255 commit 4fb6153
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
10 changes: 5 additions & 5 deletions apps/vendor-ccxt/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 }),
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -424,15 +424,15 @@ interface IGeneralSpecificRelation {
mergeMap(() => {
const balance$ = (
ex.has['watchBalance']
? defer(() => ex.watchBalance())
? defer(() => ex.watchBalance()).pipe(repeat())
: defer(() => ex.fetchBalance()).pipe(repeat({ delay: 1000 }))
).pipe(
//
shareReplay(1),
);
const positions$ = (
ex.has['watchPositions']
? defer(() => ex.watchPositions())
? defer(() => ex.watchPositions()).pipe(repeat())
: defer(() => ex.fetchPositions()).pipe(
//
repeat({ delay: 1000 }),
Expand Down
10 changes: 10 additions & 0 deletions common/changes/@yuants/vendor-ccxt/2024-02-24-15-16.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@yuants/vendor-ccxt",
"comment": "enable ccxt pro",
"type": "patch"
}
],
"packageName": "@yuants/vendor-ccxt"
}

0 comments on commit 4fb6153

Please sign in to comment.