def getListaSimbolos(self): instruments = pyRofex.get_all_instruments() lI = [] for i in instruments['instruments']: lI.append(i['instrumentId']['symbol']) lI.sort() return lI
def listarInstrumentos(): instruments = pyRofex.get_all_instruments() return instruments
Go to the official Documentation to check the API Responses. Steps: 1-Initialize the environment 2-Get all available segments and print all segment ids 3-Get a list of all instruments and then count the number of instruments return 4-Get a detailed list of the instruments and then check the Low Limit Price for the first instrument return """ import pyRofex # 1-Initialize the environment pyRofex.initialize(user="******", password="******", account="XXXXXXX", environment=pyRofex.Environment.REMARKET) # 2-Get all available segments and print all segment ids segments = pyRofex.get_segments() for segment in segments['segments']: print("Segment ID: {0}".format(segment['marketSegmentId'])) # Get a list of all instruments and then count the number of instruments return instruments = pyRofex.get_all_instruments() print("Number of Instruments: {0}".format(len(instruments['instruments']))) # 4-Get a detailed list of the instruments and then check the Low Limit Price for the first instrument return detailed = pyRofex.get_detailed_instruments() print("Low Limit Price for {0} is {1}.".format( detailed['instruments'][0]['instrumentId']['symbol'], detailed['instruments'][0]['lowLimitPrice']))
def getInstrumentos(self): instruments = pyRofex.get_all_instruments() return instruments
4-Subscribes to receive market data messages for a list of valid instruments 5-Subscribes to an invalid instrument 6-Wait 5 sec then close the connection """ import time import pprint import pyRofex import pandas as pd # 1-Initialize the environment pyRofex.initialize(user="******", password="******", account="REM5018", environment=pyRofex.Environment.REMARKET) pprint.pprint(pyRofex.get_all_instruments()) # 2-Defines the handlers that will process the messages and exceptions. def market_data_handler(message): pprint.pprint(message) def error_handler(message): print("Error Message Received: {0}".format(message)) def exception_handler(e): print("Exception Occurred: {0}".format(e.message))