项目作者: nihey

项目描述 :
Bovespa data extractor, server, and command line interface
高级语言: JavaScript
项目地址: git://github.com/nihey/node-bovespa.git
创建时间: 2015-08-19T12:15:42Z
项目社区:https://github.com/nihey/node-bovespa

开源协议:

下载


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

  1. $ npm install bovespa --save

For CLI usage it would be better to do:

  1. $ npm install bovespa -g

Usage

JavaScript

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

  1. // Using the default API (attention for the final function call):
  2. const bovespa = require("bovespa")();
  3. // Querying data:
  4. bovespa("ABEV3", "2018-04-23").then(data => {
  5. // Manipulate your data here
  6. });
  7. // What is received:
  8. bovespa("ABEV3", "2018-04-23").then(console.log);
  9. // Outputs raw bovespa data:
  10. //
  11. // {
  12. // id: 4851343,
  13. // day: '2018-04-23',
  14. // codbdi: '02',
  15. // codneg: 'ABEV3',
  16. // tpmerc: '010',
  17. // nomres: 'AMBEV S/A',
  18. // especi: 'ON',
  19. // prazot: '',
  20. // modref: 'R$',
  21. // preabe: '23.31',
  22. // premin: '23.23',
  23. // premax: '23.55',
  24. // premed: '23.40',
  25. // preult: '23.45',
  26. // preofc: '23.44',
  27. // preofv: '23.45',
  28. // preexe: '0.00',
  29. // totneg: '21813',
  30. // quatot: '8104000',
  31. // voltot: '18967719600',
  32. // indopc: '0',
  33. // fatcot: '0000001',
  34. // ptoexe: '0000000000000',
  35. // codisi: 'BRABEVACNOR1',
  36. // dismes: '119',
  37. // datven: '9999-12-31',
  38. // created_at: '2019-04-01T12:25:13.439Z',
  39. // updated_at: '2019-04-01T12:25:13.439Z'
  40. // }

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:

  1. const bovespa = require("bovespa")("https://<your own api here>");
  2. bovespa("ABEV3", "2018-04-23").then(data => {
  3. // Manipulate your data here
  4. });

CLI

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

  1. $ bovespa --help
  2. Bovespa data extractor, server, and command line interface
  3. Usage:
  4. $ bovespa <codes ...> [Options]
  5. Extracts data from bovespa and displays it on the terminal
  6. Options
  7. --date, -d <YYYY-MM-DD> [Default: Today] Which date to extract the data from
  8. --api, -a <API URL> [Default 'https://bovespa.nihey.org']
  9. Examples:
  10. $ bovespa ABEV3
  11. $ bovespa ABEV3 --date 2019-04-01
  12. $ bovespa ABEV3 PETR4 BIDI4 --date 2019-04-01

You can query historic time series by using this command:

  1. $ bovespa ABEV3 PETR4 -d 2019-04-01
  2. # Output:
  3. #
  4. # > CODE: ABEV3 @ 2019-04-01
  5. # > Variation: -0.30%
  6. # > Opening: 16.87
  7. # > Closing: 16.82
  8. # > Average: 16.85
  9. # > Max: 17.00
  10. # > Min: 16.74
  11. # >
  12. # > CODE: PETR4 @ 2019-04-01
  13. # > Variation: -1.43%
  14. # > Opening: 28.40
  15. # > Closing: 28.00
  16. # > Average: 28.11
  17. # > Max: 28.42
  18. # > Min: 27.87

License

This code is released under
CC0 (Public Domain)