How to create a program that enters the web and takes the data of the stock exchange [closed]

-5

Well my idea is to create a program that takes the data of the crypto-coins quotations so that I can keep track of them, but I do not know how to get this data live and make the program keep updating the data.     

asked by anonymous 22.12.2017 / 18:23

1 answer

1

You can use the suggestions from:

API for stock quotes of stock

They are all via HTTP and paid, the one marked as free is for the Excel program and I do not think it will serve for this, the example that seems more interesting is the Bolsafinanceira, follow the link how to use:

Rate tables:

Using with Python 3

In Python 3 you can use urllib.request with json

import json
import urllib.request

url = "http://api.bolsafinanceira.com:8080/composition/?token=<seu-token>&codelist=ibovespa,ibrx50"

with urllib.request.urlopen(urlData) as f:
   data = f.read()
   encoding = f.info().get_content_charset('utf-8')
   json.loads(data.decode(encoding))

Or use import requests

  

To install, use the command:

 pip install requests
     

Or pipenv (depends on your environment)

 pipenv install requests

It should look like this:

import requests

url = 'http://api.bolsafinanceira.com:8080/composition/?token=<seu-token>&codelist=ibovespa,ibrx50';

r = requests.get(url, print=pretty')

# Exibe a resposta
print(r.json())
    
22.12.2017 / 18:35