Skip to content

Commit

Permalink
fix(vendor-ccxt): interessant rate markprice (#458)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thrimbda authored Feb 22, 2024
1 parent e39b763 commit 447715c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
12 changes: 10 additions & 2 deletions apps/vendor-ccxt/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,23 @@ import {
).pipe(
combineLatestWith(useFundingRate(symbol)),
map(([ticker, fundingRateObj]): ITick => {
// console.info(
// formatTime(Date.now()),
// 'tick_stream',
// JSON.stringify(ticker),
// JSON.stringify(fundingRateObj),
// );
const markPrice = (fundingRateObj.markPrice || ticker.last || ticker.close)!;
return {
datasource_id: EXCHANGE_ID,
product_id,
updated_at: ticker.timestamp!,
ask: ticker.ask,
bid: ticker.bid,
price: ticker.last || ticker.close,
volume: ticker.baseVolume,
interest_rate_for_long: -fundingRateObj.fundingRate! * ticker.ask!,
interest_rate_for_short: fundingRateObj.fundingRate! * ticker.bid!,
interest_rate_for_long: -fundingRateObj.fundingRate! * markPrice,
interest_rate_for_short: fundingRateObj.fundingRate! * markPrice,
settlement_scheduled_at: fundingRateObj.fundingTimestamp,
};
}),
Expand Down
10 changes: 10 additions & 0 deletions common/changes/@yuants/vendor-ccxt/2024-02-22-21-10.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@yuants/vendor-ccxt",
"comment": "fix mark price",
"type": "patch"
}
],
"packageName": "@yuants/vendor-ccxt"
}

0 comments on commit 447715c

Please sign in to comment.