Skip to content

Latest commit

 

History

History
133 lines (100 loc) · 4.7 KB

README.md

File metadata and controls

133 lines (100 loc) · 4.7 KB

AlunaJS / Scaffolding

The first step to add a new exchange.

TL;DR

yarn add-exchange

Terminology

Before configuring the generator, the basics.

  1. Trading Features
    • The account types that trading is enabled on this exchange:
      • Spot
      • Margin
      • Derivatives
  2. API Features (that the exchange provides)
    • Order Editting
      • Does the exhange API provides a method for editing orders?
    • Position Indentifier
      • Does the exhange API provides a uid for positions?

1. Scafflding

Let's do it.

yarn add-exchange

<image-1-here>
<image-2-here>

Configure your new exchange and voilà.

If your exchangeId was 'bitfinex', you should end up with this:

src/exchanges/bitfinex
├── Bitfinex.ts
├── BitfinexAuthed.ts
├── BitfinexHttp.ts
├── bitfinexSpecs.ts
├── enums
│   └── delete-me.txt
├── errors
│   └── delete-me.txt
├── modules
│   ├── authed
│   └── public
└── schemas
    ├── IBitfinexKeySchema.ts
    ├── IBitfinexMarketSchema.ts
    └── IBitfinexSymbolSchema.ts

2. HTTP Class

First, implement an http class.

It should sign requests and send them the way the exchange expects.

Examples:

3. Enums & Schemas

Here we need to configure and the types related to the exchange.

They should completely describe the data model for all Exchange API methods.

Enums

Schemas

4. Public Modules

Implement all the public API methods:

Examples:

5. Authed Modules

Here, all the authenticated methods:

Examples: