Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OrderlyPrivate authentication & signature, and order update #2

Merged
merged 6 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/src/exchanges/FtxPrivateBase.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export declare class FtxPrivateBaseClient extends BasicPrivateClient {
protected _orderbookUpdateEvent(data: any, market: any): void;
protected _orderbookSnapshotEvent(data: any, market: any): void;
protected _orderbookEventContent(data: any, market: any): {
exchange: number | symbol | "length" | "toString" | "concat" | "indexOf" | "lastIndexOf" | "slice" | "includes" | "toLocaleString" | "join" | "every" | "some" | "forEach" | "map" | "filter" | "reduce" | "reduceRight" | "find" | "findIndex" | "entries" | "keys" | "values" | "flatMap" | "flat" | "pop" | "push" | "reverse" | "shift" | "sort" | "splice" | "unshift" | "fill" | "copyWithin";
exchange: number | symbol | "length" | "toString" | "toLocaleString" | "pop" | "push" | "concat" | "join" | "reverse" | "shift" | "slice" | "sort" | "splice" | "unshift" | "indexOf" | "lastIndexOf" | "every" | "some" | "forEach" | "map" | "filter" | "reduce" | "reduceRight" | "find" | "findIndex" | "fill" | "copyWithin" | "entries" | "keys" | "values" | "includes" | "flatMap" | "flat";
base: any;
quote: any;
timestampMs: number;
Expand Down
225 changes: 225 additions & 0 deletions dist/src/exchanges/OrderlyClient.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
/// <reference types="node" />
import { BasicClient } from "../BasicClient";
import { Candle } from "../Candle";
import { CandlePeriod } from "../CandlePeriod";
import { ClientOptions } from "../ClientOptions";
import { CancelableFn } from "../flowcontrol/Fn";
import { Level2Snapshot } from "../Level2Snapshots";
import { Level2Update } from "../Level2Update";
import { Market } from "../Market";
import { Ticker } from "../Ticker";
import { Trade } from "../Trade";
export declare type OrderlyClientOptions = ClientOptions & {
sendThrottleMs?: number;
};
declare type KlineType = "1m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "12h" | "1d" | "3d" | "1w" | "2w";
interface IKlineObject {
topic: string;
ts: number;
data: {
symbol: string;
type: KlineType;
open: number;
close: number;
high: number;
low: number;
volume: number;
amount: number;
startTime: number;
endTime: number;
};
}
export declare class OrderlyClient extends BasicClient {
candlePeriod: CandlePeriod;
protected _sendMessage: CancelableFn;
protected _pingInterval: NodeJS.Timeout;
constructor({ wssPath, watcherMs, sendThrottleMs, }?: OrderlyClientOptions);
protected _beforeClose(): void;
protected _beforeConnect(): void;
protected _startPing(): void;
protected _stopPing(): void;
protected _sendPing(): void;
protected _sendPong(): void;
/**
* Constructs a market argument in a backwards compatible manner where
* the default is a spot market.
*/
protected _marketArg(method: string, market: Market): string;
/**
* Gets the exchanges interpretation of the candle period
*/
protected _candlePeriod(period: CandlePeriod): "kline_1m" | "kline_5m" | "kline_15m" | "kline_30m" | "kline_1h" | "kline_1d" | "kline_1w";
protected __sendMessage(msg: any): void;
protected _sendSubTicker(remote_id: any, market: any): void;
protected _sendUnsubTicker(remote_id: any, market: any): void;
protected _sendSubTrades(remote_id: any, market: any): void;
protected _sendUnsubTrades(remote_id: any, market: any): void;
protected _sendSubCandles(remote_id: any, market: any): void;
protected _sendUnsubCandles(remote_id: any, market: any): void;
protected _sendSubLevel2Snapshots(remote_id: any, market: any): void;
protected _sendUnsubLevel2Snapshots(remote_id: any, market: any): void;
protected _sendSubLevel2Updates(remote_id: any, market: any): void;
protected _sendUnsubLevel2Updates(remote_id: any, market: any): void;
protected _sendSubLevel3Snapshots: (...args: any[]) => any;
protected _sendUnsubLevel3Snapshots: (...args: any[]) => any;
protected _sendSubLevel3Updates: (...args: any[]) => any;
protected _sendUnsubLevel3Updates: (...args: any[]) => any;
protected _onMessage(compressed: any): void;
protected _processsMessage(msg: any): void;
/**
* Process ticker messages in the format
{ table: 'spot/ticker',
data:
[ { instrument_id: 'ETH-BTC',
last: '0.02181',
best_bid: '0.0218',
best_ask: '0.02181',
open_24h: '0.02247',
high_24h: '0.02262',
low_24h: '0.02051',
base_volume_24h: '379522.2418555',
quote_volume_24h: '8243.729793336415',
timestamp: '2019-07-15T17:10:55.671Z' } ] }
*/
protected _processTicker(msg: any): void;
/**
* Processes trade messages in the format
{ table: 'spot/trade',
data:
[ { instrument_id: 'ETH-BTC',
price: '0.0218',
side: 'sell',
size: '1.1',
timestamp: '2019-07-15T17:10:56.047Z',
trade_id: '776432498' } ] }
*/
protected _processTrades(msg: any): void;
/**
* Processes a candle message
{
"table": "spot/candle60s",
"data": [
{
"candle": [
"2020-08-10T20:42:00.000Z",
"0.03332",
"0.03332",
"0.03331",
"0.03332",
"44.058532"
],
"instrument_id": "ETH-BTC"
}
]
}
*/
protected _processCandles(msg: IKlineObject): void;
/**
* Processes a level 2 snapshot message in the format:
{ table: 'spot/depth5',
data: [{
asks: [ ['0.02192', '1.204054', '3' ] ],
bids: [ ['0.02191', '15.117671', '3' ] ],
instrument_id: 'ETH-BTC',
timestamp: '2019-07-15T16:54:42.301Z' } ] }
*/
protected _processLevel2Snapshot(msg: any): void;
/**
* Processes a level 2 update message in one of two formats.
* The first message received is the "partial" orderbook and contains
* 200 records in it.
*
{ table: 'spot/depth',
action: 'partial',
data:
[ { instrument_id: 'ETH-BTC',
asks: [Array],
bids: [Array],
timestamp: '2019-07-15T17:18:31.737Z',
checksum: 723501244 } ] }
*
* Subsequent calls will include the updates stream for changes to
* the order book:
*
{ table: 'spot/depth',
action: 'update',
data:
[ { instrument_id: 'ETH-BTC',
asks: [Array],
bids: [Array],
timestamp: '2019-07-15T17:18:32.289Z',
checksum: 680530848 } ] }
*/
protected _processLevel2Update(msg: any): void;
/**
* Constructs a ticker from the datum in the format:
{ instrument_id: 'ETH-BTC',
last: '0.02172',
best_bid: '0.02172',
best_ask: '0.02173',
open_24h: '0.02254',
high_24h: '0.02262',
low_24h: '0.02051',
base_volume_24h: '378400.064179',
quote_volume_24h: '8226.4437921288',
timestamp: '2019-07-15T16:10:40.193Z' }
*/
protected _constructTicker(data: any, market: any): Ticker;
/**
* Constructs a trade from the message datum in format:
{ instrument_id: 'ETH-BTC',
price: '0.02182',
side: 'sell',
size: '0.94',
timestamp: '2019-07-15T16:38:02.169Z',
trade_id: '776370532' }
*/
protected _constructTrade(datum: any, market: any): Trade;
/**
* Constructs a candle for the market
{
"candle": [
"2020-08-10T20:42:00.000Z",
"0.03332",
"0.03332",
"0.03331",
"0.03332",
"44.058532"
],
"instrument_id": "ETH-BTC"
}
* @param {*} datum
*/
protected _constructCandle(datum: any): Candle;
/**
* Constructs a snapshot message from the datum in a
* snapshot message data property. Datum in the format:
*
{ instrument_id: 'ETH-BTC',
asks: [ ['0.02192', '1.204054', '3' ] ],
bids: [ ['0.02191', '15.117671', '3' ] ],
timestamp: '2019-07-15T16:54:42.301Z' }
*
* The snapshot may also come from an update, in which case we need
* to include the checksum
*
{ instrument_id: 'ETH-BTC',
asks: [ ['0.02192', '1.204054', '3' ] ],
bids: [ ['0.02191', '15.117671', '3' ] ],
timestamp: '2019-07-15T17:18:31.737Z',
checksum: 723501244 }

*/
protected _constructLevel2Snapshot(datum: any, market: any): Level2Snapshot;
/**
* Constructs an update message from the datum in the update
* stream. Datum is in the format:
{ instrument_id: 'ETH-BTC',
asks: [ ['0.02192', '1.204054', '3' ] ],
bids: [ ['0.02191', '15.117671', '3' ] ],
timestamp: '2019-07-15T17:18:32.289Z',
checksum: 680530848 }
*/
_constructLevel2Update(datum: any, market: any): Level2Update;
}
export {};
Loading