Giter Site home page Giter Site logo

okx-api's Introduction

OKX Exchange API

This is an API that uses OKX API to estimate trade prices and execute orders.

Install

npm install
docker-compose up

Run the app

npm run start

Run the tests

npm run test:e2e

Environment Variables

OKX_URL=
API_KEY=
SECRET_KEY=
OK_ACCESS_PASSPHRASE=
OPERATING_FEE= 0.0025
SPREAD= 0.005
EXPIRATION_SECONDS= 45

REST API

This is an example of how the service works:

Estimate a price

This endpoint estimates a price given a pair, volume and side. It returns an estimated price, an estimation expiration date, and an estimation order ID, to execute it later.

Request

POST api/estimate-price/

body: {
  "pair": "BTC-USDT",
  "volume": 1.2,
  "side": "buy"
}

Response

{
  "estimatedPrice": 46263.96648,
  "expirationDate": "2022-04-05T18:48:57.537Z",
  "orderId": 5
}

Execute an order

This endpoint receives an order ID, to execute an estimated order, with its pair and volume. It returns the estimated and executed price.

Request

POST api/execute-order/

body: {
  orderId: 5
}

Response

{
  "estimatedPrice": 46263.96648,
  "executedPrice": 46269.12733
}

okx-api's People

Contributors

santiagolop avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.