0.0.19 • Published 5 years ago

finevotech-web v0.0.19

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

📦 Install

npm install finevo-order-form
yarn add finevo-order-form

🔨 Usage

If you have not started with web components, we suggest you to visit the official docs

import { FinOrderForm } from 'finevo-order-form';

//register the component as a custom element with the browser
customElements.define('fin-order-form', FinOrderForm);

And using it with the accessToken

<fin-order-form accessToken="a-valid-jwt-token"></fin-order-form>

You will need to define an options property for the custom component in the following format (The order form will not load unless these properties as defined):

const FinOrderForm = document.querySelector('fin-order-form');

//attaching default properties
FinOrderForm.options = {
    config: {...},
    order:{
        uuid: 'unique-id-for-the-orders',
        price: 5.29,
        side: "1",
        triggerType: '3',
        triggerPriceDirection: '1'
    },
    company: {
        name: 'CIMB',
        id: '1023', 
        exchange: 'BM',
        type: 'NM',
    }    
}

//attaching listener to listen for order events from our Market Order Aggregator
OrderForm.addEventListener('order', event => console.log(event));

Alternatively, using js

const FinOrderForm = document.createElement('fin-order-form');
FinOrderForm.setAttribute('accessToken', 'a-valid-jwt-token');
document.body.appendChild(FinOrderForm);
FinOrderForm.options = {...};

📃 Property Configuration

Under construction 🔨🔨🔨