Coder Social home page Coder Social logo

node-bovespa's Introduction

Node Bovespa

Warning: This module is currently partially active, due to bovespa's original API disappearance. But it will be brought back to you once we can work around that issue.

Access bovespa/B3 data in many ways:

  • API
  • JavaScript module

Also:

  • Scrap and organize data from bovespa's historic time series

Dependency Status Build Status

Why

Free B3 data extraction is poor, the few places that have it have high costs for starters.

This project was done so that developers like you and me can have access to B3 data in a easier way and develop nice things on top of it.

Installing

$ npm install bovespa --save

For CLI usage it would be better to do:

$ npm install bovespa -g

Usage

JavaScript

We use the promise API to fetch all sorts of data:

// Using the default API (attention for the final function call):
const bovespa = require("bovespa")();

// Querying data:
bovespa("ABEV3", "2018-04-23").then(data => {
  // Manipulate your data here
});

// What is received:
bovespa("ABEV3", "2018-04-23").then(console.log);
// Outputs raw bovespa data:
//
// {
//   id: 4851343,
//   day: '2018-04-23',
//   codbdi: '02',
//   codneg: 'ABEV3',
//   tpmerc: '010',
//   nomres: 'AMBEV S/A',
//   especi: 'ON',
//   prazot: '',
//   modref: 'R$',
//   preabe: '23.31',
//   premin: '23.23',
//   premax: '23.55',
//   premed: '23.40',
//   preult: '23.45',
//   preofc: '23.44',
//   preofv: '23.45',
//   preexe: '0.00',
//   totneg: '21813',
//   quatot: '8104000',
//   voltot: '18967719600',
//   indopc: '0',
//   fatcot: '0000001',
//   ptoexe: '0000000000000',
//   codisi: 'BRABEVACNOR1',
//   dismes: '119',
//   datven: '9999-12-31',
//   created_at: '2019-04-01T12:25:13.439Z',
//   updated_at: '2019-04-01T12:25:13.439Z'
// }

The name of the fields are the same expressed on the ones shown on B3's official archives. You can have a reference on what they mean by going to this link

You can use a different server to fetch data from your own API too:

const bovespa = require("bovespa")("https://<your own api here>");

bovespa("ABEV3", "2018-04-23").then(data => {
  // Manipulate your data here
});

CLI

Command line help should give you a good guide on how to use the project

$ bovespa --help

  Bovespa data extractor, server, and command line interface

  Usage:
    $ bovespa <codes ...> [Options]

    Extracts data from bovespa and displays it on the terminal

    Options
      --date, -d <YYYY-MM-DD> [Default: Today] Which date to extract the data from
      --api, -a <API URL> [Default 'https://bovespa.nihey.org']

    Examples:
      $ bovespa ABEV3
      $ bovespa ABEV3 --date 2019-04-01
      $ bovespa ABEV3 PETR4 BIDI4 --date 2019-04-01

You can query historic time series by using this command:

$ bovespa ABEV3 PETR4 -d 2019-04-01

# Output:
#
# > CODE: ABEV3 @ 2019-04-01
# > Variation: -0.30%
# > Opening: 16.87
# > Closing: 16.82
# > Average: 16.85
# > Max: 17.00
# > Min: 16.74
# >
# > CODE: PETR4 @ 2019-04-01
# > Variation: -1.43%
# > Opening: 28.40
# > Closing: 28.00
# > Average: 28.11
# > Max: 28.42
# > Min: 27.87

License

This code is released under CC0 (Public Domain)

node-bovespa's People

Contributors

nihey avatar dependabot[bot] 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.