Coder Social home page Coder Social logo

node-iol-v2's Introduction

Node.Js ultra-light wrapper for InvertirOnLine REST API V2

Disclaimer: I'm not responsible for any damage, of any way, when using this module, if you find any kind of problems, create an issue! Also: I'm not giving any investing advise here, all you see here is personal work and does not have any relationship with the company I work for or any company I worked or I will work in the future!.

Link to Github repo

How to start using this package

  1. Ask the guys of InvertirOnline to enable you the API (at the time this was published it was still free and we want them to keep it this way to foster the argentinian capital markets!)
  2. Install Node.Js
  3. Clone/Download this repo OR create a new folder with any name and do npm install node-iol-v2
  4. Complete the auth.json file with your username and password (if you did the npm install, the file will be inside your node-modules folder)
  5. Enjoy!

Usage

First we create a file (can be index.js) where we require this package if we did the npm install node-iol-v2 thing const iol = require('node-iol'); or, if we downloaded from github, we require the file directly const iol = require('./node-iol'); Then we write some code like this one:

let iol = require ("./node-iol")

async function getMEPDollarQuote() {
    let token = await iol.auth();
    let ay24 = await iol.getTickerValue(token, 'bcba', 'ay24');
    console.log(ay24.ultimoPrecio);
    let ay24d = await iol.getTickerValue(token, 'bcba', 'ay24d');
    console.log(ay24d.ultimoPrecio);
    console.log('Purchasing dollars in the stock market costs:', ay24.ultimoPrecio/ay24d.ultimoPrecio);
}

getMEPDollarQuote()

or maybe something like a CCL (contado con liqui) finder:

const iol = require('./node-iol');

async function cclGGAL() {
    let token = await iol.auth();
    let ggal = await iol.getTickerValue(token, 'bCBA', 'GGAL');
    let ggald = await iol.getTickerValue(token, 'nYSE', 'GGAL');

    let ccl = (ggal.ultimoPrecio/ggald.ultimoPrecio) * 10; // multiplied by 10 due to conversion factor to calculate CCL;

    console.log('GGAL price in ARG', ggal.ultimoPrecio);
    console.log('GGAL price in USA', ggald.ultimoPrecio);

    console.log('so...');

    console.log(`CCL price for GGAL is ${ccl}`);
}

cclGGAL()

Notes

  • Be extremely careful when calling methods, as I've done this in a couple of hours and it might not cover all cases (like get values that accepts a term but I haven't covered that and might be useful to calculate intrinsic rates!!!)

To Do

  • Tests Tests Tests (Mocha)
  • Review The getTickerValuesBetweenDates function, haven't tried it, specially dates formats
  • Polish the username/password authentication (hey! this was done in just one day!)

node-iol-v2's People

Contributors

paoliniluis avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.