0.1.4 • Published 2 years ago

@simulate-exchange/core v0.1.4

Weekly downloads
-
License
GPL-3.0-only
Repository
github
Last release
2 years ago

Simulate.Exchange - JS Client

Introduction

This library is used to wrap the API of the Simulate.Exchange stock exchange. Using it, it is easy to create a trading bot in Node.JS.

Getting Started

Prerequisites

  • Node.JS
  • A Simulate.Exchange API Key
  • A port and hostname of a Simulate.Exchange server

Setup

import { Client } from "@simulate-exchange/core";

const HOST = "EXCHANGE_HOSTNAME"; // INSERT EXCHANGE HOSTNAME HERE
const PORT = 15001; // INSERT EXCHANGE PORT HERE

const ws = new Client(HOST, PORT);

ws.on("feed", (f) => {
  console.log(f);
});

ws.on("fill", (order) => {
  console.log(order);
});

ws.on("update", (order) => {
  console.log(order);
});

// Login to the exchange with your API key.
ws.login("YOUR_API_KEY_HERE");

Sending Requests

// Sending an insert order
const orderId = ws.insertOrder({
  instrumentId: 0,
  lifespan: Lifespan.GFD, // or Lifespan.FAK
  price: 140,
  volume: 100,
  side: Side.BUY, // or Side.SELL
});

// Cancelling the order with ID = 4
ws.cancelOrder(4);
0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.1

2 years ago