GithubHelp home page GithubHelp logo

apolofx / iol-api-node-wrapper Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 1.0 11.97 MB

NodeJS wrapper for Invertir Online API Service. This repo is just for testing purposes and you should not take it as an official productive solution.

License: MIT License

JavaScript 1.28% TypeScript 98.17% Shell 0.55%
typescript nodejs jest

iol-api-node-wrapper's Introduction

Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. version npm version GitHub Workflow Status (branch) typescript

IOL API NodeJS Wrapper

Prerequisites

  1. Have a valid IOL account.
  2. Have access to IOL API. (Send an email to IOL Support requesting for the API access).
  3. NodeJS installed

Installation

npm

npm i iol-api-node-wrapper

yarn

yarn add iol-api-node-wrapper

Usage example

  const { IolClient } = require("iol-api-node-wrapper");

// Initialize client with config
const config = {
      url: "https://api.invertironline.com",
      password: <your IOL password>,
      username: <your IOL username>,
      }

const iol = new IolClient(config);
async function main() {
  const account = await iol.getAccountStatus();
  console.log(account);
}
main();

Authentication

Once a new IolClient object has been instantiated with authentication data, authentication is managed internally by the library and there is no need to request a new access-token every time you call the API. IolClient uses IOL's refresh-token to request a new access-token if the current one has expired.

Types

This project is written in typescript and we are trying to type not only the wrapper interface methods but also IOL's API responses models. This makes it a lot easier to work with the wrapper response object as it has editor's (VSCode) intellisense features enhanced by typescript. If you don't use VSCode which has already typescript support, you can easily install typescript in your project or globally in your system.

Wrapper Interface

// GET /api/v2/portafolio/{pais}
await iol.getPortfolio("argentina");

// GET /api/v2/estadocuenta
await iol.getAccountStatus();

// GET /api/v2/operaciones/{numero}
await iol.getOperation(1234);

// GET /api/v2/operaciones
await iol.getOperations({
  estado: "pendientes",
  fechaDesde: new Date(new Date().setDate(10)).toString(),
  fechaHasta: new Date(new Date().setDate(15)).toString(),
  numero: 1234,
  pais: "argentina",
});

// DELETE /api/v2/operaciones/{numero}
await iol.deleteOperation(1234);

// POST /api/v2/operar/Comprar
await iol.buy({
  mercado: "bCBA",
  plazo: "t0",
  precio: 123,
  simbolo: "GGAL",
  validez: new Date(),
});

// POST /api/v2/operar/Vender
await iol.sell({
  mercado: "bCBA",
  plazo: "t0",
  precio: 123,
  cantidad: 1,
  simbolo: "GGAL",
  validez: new Date(new Date().setDate(20)),
});

// POST /api/v2/operar/suscripcion/fci
await iol.fciSubscription({ monto: 123, simbolo: "CRTAFAA" });

// POST /api/v2/operar/rescate/fci
await iol.fciRescue({ cantidad: 1, simbolo: "CRTAFAA" });

// GET /api/v2/{Mercado}/Titulos/{Simbolo}/Cotizacion
await iol.getPrice("rOFX", "DLR102021");

// GET /api/v2/{Mercado}/Titulos/{Simbolo}/Opciones
await iol.getOptions("bCBA", "GGAL");

// GET /api/v2/Titulos/FCI/{simbolo}
await iol.getFCI("CRTAFAA");

// GET /api/v2/Titulos/FCI
await iol.getAllFCI();

//GET /api/v2/Cotizaciones/{Instrumento}/{Panel}/{Pais}
await iol.getQuotes("opciones", "calls", "argentina");

API Wrapper progress

[ IOL API VERSION: V2 ]

AsesoresTestInversor

⬜️ GET /api/v2/asesores/test-inversor

⬜️ POST /api/v2/asesores/test-inversor/{idClienteAsesorado}

MiCuenta

GET /api/v2/estadocuenta

GET /api/v2/portafolio/{pais}

DELETE /api/v2/operaciones/{numero}

GET /api/v2/operaciones/{numero}

GET /api/v2/operaciones

Operar

POST /api/v2/operar/Vender

POST /api/v2/operar/Comprar

POST /api/v2/operar/rescate/fci

POST /api/v2/operar/suscripcion/fci

Titulos

GET /api/v2/Titulos/FCI

GET /api/v2/Titulos/FCI/{simbolo}

⬜️ GET /api/v2/Titulos/FCI/TipoFondos

⬜️ GET /api/v2/Titulos/FCI/Administradoras

⬜️ GET /api/v2/{mercado}/Titulos/{simbolo}

GET /api/v2/{mercado}/Titulos/{simbolo}/Opciones

⬜️ GET /api/v2/{pais}/Titulos/Cotizacion/Instrumentos

GET /api/v2/Cotizaciones/{Instrumento}/{Panel}/{Pais}

⬜️ GET /api/v2/{pais}/Titulos/Cotizacion/Paneles/{instrumento}

GET /api/v2/{Mercado}/Titulos/{Simbolo}/Cotizacion

⬜️ GET /api/v2/Titulos/FCI/Administradoras/{administradora}/TipoFondos

⬜️ GET /api/v2/Titulos/FCI/Administradoras/{administradora}/TipoFondos/{tipoFondo}

⬜️ GET /api/v2/{mercado}/Titulos/{simbolo}/Cotizacion/seriehistorica/{fechaDesde}/{fechaHasta}/{ajustada}

LICENCE

MIT

iol-api-node-wrapper's People

Contributors

apolofx avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

yoshima11

iol-api-node-wrapper's Issues

check the latency introduced by the useAuth requests middleware

//TODO check the latency introduced by the useAuth requests middleware
private async useAuth(
requestConfig: AxiosRequestConfig
): Promise<AxiosRequestConfig> {
const newToken = await this.auth.getToken();
requestConfig.headers["Authorization"] = `bearer ${newToken}`;


This issue was generated by todo based on a TODO comment in 478ec25 when #13 was merged. cc @Apolofx.

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.