Skip to content

Commit

Permalink
chore: up ccxt version 4.1.484.3.27
Browse files Browse the repository at this point in the history
  • Loading branch information
bludnic committed May 19, 2024
1 parent 1f4b5e0 commit b7a44f4
Show file tree
Hide file tree
Showing 18 changed files with 97 additions and 91 deletions.
2 changes: 1 addition & 1 deletion apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@trpc/server": "^10.45.2",
"axios": "^1.6.8",
"big.js": "^6.2.1",
"ccxt": "4.1.48",
"ccxt": "4.3.27",
"clsx": "^2.1.1",
"date-fns": "^2.30.0",
"final-form": "^4.20.10",
Expand Down
10 changes: 5 additions & 5 deletions apps/frontend/src/ui/charts/Chart/BaseChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ function normalizeCandle(candle: OHLCV) {
const [timestamp, open, high, low, close] = candle;

return {
time: (new Date(timestamp).getTime() / 1000) as UTCTimestamp,
open,
high,
low,
close,
time: (new Date(timestamp!).getTime() / 1000) as UTCTimestamp,
open: open!,
high: high!,
low: low!,
close: close!,
};
}

Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/ui/charts/Chart/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ export function logCandle(message: string, candle: OHLCV) {
volume,
"timestamp",
timestamp,
new Date(timestamp).toISOString(),
new Date(timestamp!).toISOString(),
);
}
2 changes: 1 addition & 1 deletion apps/processor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@trpc/server": "^10.45.2",
"@types/express": "^4.17.21",
"async": "^3.2.5",
"ccxt": "4.1.48",
"ccxt": "4.3.27",
"cookie-parser": "^1.4.6",
"cors": "^2.8.5",
"date-fns": "^2.30.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@opentrader/processing": "workspace:*",
"@opentrader/tools": "workspace:*",
"async": "^3.2.5",
"ccxt": "4.1.48",
"ccxt": "4.3.27",
"node-cron": "^3.0.3"
}
}
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@opentrader/processing": "workspace:*",
"@opentrader/tools": "workspace:*",
"@prisma/client": "5.13.0",
"ccxt": "4.1.48",
"ccxt": "4.3.27",
"commander": "^12.0.0",
"json5": "^2.2.3"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/exchanges/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
"dependencies": {
"@opentrader/db": "workspace:*",
"@opentrader/tools": "workspace:*",
"ccxt": "4.1.48"
"ccxt": "4.3.27"
}
}
2 changes: 1 addition & 1 deletion packages/exchanges/src/exchanges/ccxt/exchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export class CCXTExchange implements IExchange {
const markets = await this.loadMarkets();

const spotMarkets = Object.entries(markets)
.filter(([_currency, market]) => market.type === type)
.filter(([_currency, market]) => market?.type === type)
.reduce<Dictionary<Market>>((acc, [currency, market]) => {
return {
...acc,
Expand Down
56 changes: 28 additions & 28 deletions packages/exchanges/src/exchanges/ccxt/normalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const getLimitOrder: Normalize["getLimitOrder"] = {
price: order.price,
filledPrice: order.average || null,
status: normalizeOrderStatus(order),
fee: order.fee.cost,
fee: order.fee?.cost || 0,
createdAt: order.timestamp,
lastTradeTimestamp: order.lastTradeTimestamp,
}),
Expand Down Expand Up @@ -80,7 +80,7 @@ const getOpenOrders: Normalize["getOpenOrders"] = {
price: order.price,
filledPrice: null,
status: normalizeOrderStatus(order),
fee: order.fee.cost,
fee: order.fee?.cost || 0,
createdAt: order.timestamp,
lastTradeTimestamp: order.lastTradeTimestamp,
})),
Expand All @@ -97,7 +97,7 @@ const getClosedOrders: Normalize["getClosedOrders"] = {
price: order.price,
filledPrice: order.average || order.price, // assume that filled order must always contain `order.average`
status: normalizeOrderStatus(order),
fee: order.fee.cost,
fee: order.fee?.cost || 0,
createdAt: order.timestamp,
lastTradeTimestamp: order.lastTradeTimestamp,
})),
Expand All @@ -107,45 +107,45 @@ const getMarketPrice: Normalize["getMarketPrice"] = {
request: (params) => [params.symbol],
response: (ticker) => ({
symbol: ticker.symbol,
price: ticker.last || ticker.bid || ticker.ask,
timestamp: ticker.timestamp,
price: ticker.last! || ticker.bid! || ticker.ask!,
timestamp: ticker.timestamp!,
}),
};

const getCandlesticks: Normalize["getCandlesticks"] = {
request: (params) => [params.symbol, params.bar, params.since, params.limit],
response: (candlesticks) =>
candlesticks.map((candlestick) => ({
timestamp: candlestick[0],
open: candlestick[1],
high: candlestick[2],
low: candlestick[3],
close: candlestick[4],
timestamp: candlestick[0]!,
open: candlestick[1]!,
high: candlestick[2]!,
low: candlestick[3]!,
close: candlestick[4]!,
})),
};

const getSymbol: Normalize["getSymbol"] = {
request: (params) => [params.currencyPair],
response: (market) => ({
symbolId: composeSymbolIdFromPair(ExchangeCode.OKX, market.symbol),
currencyPair: market.symbol,
symbolId: composeSymbolIdFromPair(ExchangeCode.OKX, market!.symbol),
currencyPair: market!.symbol,
exchangeCode: ExchangeCode.OKX,
exchangeSymbolId: market.id,
exchangeSymbolId: market!.id,

baseCurrency: market.base,
quoteCurrency: market.quote,
baseCurrency: market!.base,
quoteCurrency: market!.quote,

filters: {
precision: market.precision,
precision: market!.precision,
decimals: {
amount: market.precision.amount
? getExponentAbs(market.precision.amount)
amount: market!.precision.amount
? getExponentAbs(market!.precision.amount)
: undefined,
price: market.precision.price
? getExponentAbs(market.precision.price)
price: market!.precision.price
? getExponentAbs(market!.precision.price)
: undefined,
},
limits: market.limits,
limits: market!.limits,
},
}),
};
Expand All @@ -168,7 +168,7 @@ const watchOrders: Normalize["watchOrders"] = {
price: order.price,
filledPrice: order.average || null,
status: normalizeOrderStatus(order),
fee: order.fee.cost,
fee: order.fee?.cost || 0,
createdAt: order.timestamp,
lastTradeTimestamp: order.lastTradeTimestamp,
})),
Expand All @@ -178,12 +178,12 @@ const watchCandles: Normalize["watchCandles"] = {
request: (params) => [params.symbol],
response: (ohlcv) =>
ohlcv.map((order) => ({
timestamp: order[0],
open: order[1],
high: order[2],
low: order[3],
close: order[4],
volume: order[5],
timestamp: order[0]!,
open: order[1]!,
high: order[2]!,
low: order[3]!,
close: order[4]!,
volume: order[5]!,
})),
};

Expand Down
2 changes: 1 addition & 1 deletion packages/processing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
"@opentrader/exchanges": "workspace:*",
"@opentrader/logger": "workspace:*",
"@prisma/client": "5.13.0",
"ccxt": "4.1.48"
"ccxt": "4.3.27"
}
}
2 changes: 1 addition & 1 deletion packages/trpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@opentrader/processing": "workspace:*",
"@opentrader/tools": "workspace:*",
"@trpc/server": "^10.45.2",
"ccxt": "4.1.48",
"ccxt": "4.3.27",
"superjson": "^1.13.3",
"zod": "3.22.4"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface IClosedOrder {
/**
* Client-supplied order ID
*/
clientOrderId: string;
clientOrderId?: string;
side: OrderSide;
/**
* Quantity to buy or sell.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface IGetLimitOrderResponse {
/**
* Client-supplied order ID
*/
clientOrderId: string;
clientOrderId?: string;
side: OrderSide;
/**
* Quantity to buy or sell.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface IOpenOrder {
/**
* Client-supplied order ID
*/
clientOrderId: string;
clientOrderId?: string;
side: OrderSide;
/**
* Quantity to buy or sell.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export interface IPlaceLimitOrderResponse {
/**
* Client-supplied order ID
*/
clientOrderId: string;
clientOrderId?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export interface IPlaceStopOrderResponse {
/**
* Client-supplied order ID
*/
clientOrderId: string;
clientOrderId?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface IWatchOrder {
/**
* Client-supplied order ID
*/
clientOrderId: string;
clientOrderId?: string;
side: OrderSide;
/**
* Quantity to buy or sell.
Expand Down
Loading

0 comments on commit b7a44f4

Please sign in to comment.