Shift Client SDK
SDK for working with exchanges running on Shift Markets' Cointrader technology. Provides quick access to market data, trading, KYC, deposits & withdrawals, and more.
Installation
npm install https://github.com/ShiftForex/shiftmarkets-sdk
Getting Started
- Clone the SDK
git clone https://github.com/ShiftForex/shiftmarkets-sdk.git
- Run
npm install
- You can optionally install ts-node globally to make it easier to run examples:
npm install -g ts-node
- In the code examples, environment variables are used to initiate the SDK and receive access tokens:
SDK_EXCHANGE
,SDK_ENVIRONMENT
,SDK_USERNAME
,SDK_PASSWORD
- Navigate into the examples directory to run TypeScript examples with ts-node. E.g.:
cd examples/
ts-node get-settings.ts
- Alternatively, if you're not running ts-node: compile the TypeScript code and navigate into examples/dist/examples to run examples with Node. E.g.:
npm run build-examples
cd examples/dist/examples/
node get-settings.js
Code Examples
Working with Orders: In this example, we authenticate with the SDK before subscribing to websocket order updates, placing a limit order, querying for the order, cancelling the order, and finally closing the websocket connection.
Instruments and Products: We initiate the SDK aginst a given exchange and authenticate, then get the instruments and products available on the exchange.
Submitting KYC Data: After authenticating, the example shows how to use the SDK to query for the KYC schema and submit updated KYC data.
Getting KYC Data: In this example, we authenticate with the SDK before querying for a summary of the user's KYC details.
Payment Routes and Options: After authenticating, this example uses the SDK to get payment routes and payment options for a given product.
Working with RFQ: This example shows how to authenticate and use the SDK to get quotes from the Shift RFQ system for a given instrument and amount.
Working with User Settings: After authenticating, the example shows how to use the SDK to set some mock user settings and query for the settings.
Wallet Transaction History: After authentication with the SDK, the example queries for user's wallet transactions using various filters.
Getting Webconfig: After initiating the SDK against a given exchange, the example shows how to get the webconfig for that exchange. Authentication is not required for this endpoint.
Instant Buy: In this example, we authenticate then use the SDK to get an instant buy estimate, create an instant buy order, and query for the instant buy order.
Quote Currency Market Order: We authenticate with the SDK, then create a quote currency market order using the BTCUSD instrument, and finally query for market orders using an example filter.
Working with Deposits: After authenticating, the example shows how to get the deposit schema for a given product and create a deposit.
Working with Withdrawals: After authenticating, the example shows how to get the withdrawal schema for a given product and create a withdrawal.
Historical and Current Bars: This example shows how to use the SDK to get historical bars and subscribe to bar updates, before finally unsubscribing. Authentication is not required for these endpoints.
Tickers and Orderbooks: In this example, we show how to initiate the SDK against an exchange, then subscribe to a given instrument's ticker and orderbook websocket updates, before unsubscribing after 30 seconds. Authentication is not required for these endpoints.
Vault transactions: This example shows how to get accrual fees for NXL owner