/openapi-samples-js

Sample code demonstrating OpenAPI interactions in JavaScript

Primary LanguageJavaScriptApache License 2.0Apache-2.0

OpenAPI JavaScript Sample Repository

This repository contains sample files demonstrating OpenAPI interactions in JavaScript that can be run in the browser. Each of the included samples is designed as standalone HTML with vanilla JS and no dependencies.

To try these samples yourself, download/clone this repo and load the HTML files locally on your browser. You can alternatively navigate to this interactive page to select the samples hosted directly online.

Requirements

Samples run against Saxo's simulation environment and require an access token in order to function. Saxo provides 24-hour tokens on the Developer Portal, which is the easiest way to get started with the samples provided here. An account is required to generate a token, which can be created for free.

Table of Contents

  1. Authentication
  2. Basics
  3. Instruments
  4. Order Placement
  5. Portfolio
  6. Account History
  7. Using websockets

Sample Apps

Basic Price Streamer: Shows how to display prices for instruments and update them when an update is broadcasted. The connection health is monitored.

Basic Order Manager: A Vue.js app that runs in the browser, pulls out open orders of the logged-in client and displays them in a Vuetify table with sorting and filtering functionality. Includes a simple order blotter and an implementation of OAuth implicit flow to authenticate with the OpenAPI.

Suggestions? Comments? Reach us via Github or openapisupport@saxobank.com.