forked from paredesivan/bolsuite.python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReadme
More file actions
46 lines (32 loc) · 2.77 KB
/
Readme
File metadata and controls
46 lines (32 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
The code you've provided appears to be a Python script that serves as a connector to the Bolsuite Web API. This API seems to be used for retrieving financial market data related to various instruments like stocks, bonds, options, commodities, and more. The code defines a Python class named Connector, which encapsulates methods for interacting with the API and fetching different types of financial data. Here's an overview of the key components and functionalities in the code:
Import Statements: The script starts by importing the necessary Python modules:
requests: Used for making HTTP requests to the API.
pandas: Used for data manipulation and analysis.
numpy: Used for numerical operations.
json: Used for handling JSON data.
Connector Class Definition: The main part of the script defines a Python class named Connector.
Initialization: The __init__ method initializes the class instance with a base URL, which is the URL of the Bolsuite Web API. If no base URL is provided, it defaults to 'http://localhost:6091'.
Private Methods for Data Retrieval and Transformation: The class contains several private methods (methods starting with an underscore) that are responsible for retrieving data from the API and transforming it into pandas DataFrames.
Public Methods for Data Retrieval: The class provides a series of public methods that serve as an interface for retrieving specific types of financial data. These methods include:
indices
bluechips
general_board
cedear_stocks
government_bonds
government_short_term_bonds
options
repos
corporate_bonds
term_by_batches
adrs
currency_pairs
commodities
world_indices
world_indices_futures
personal_portfolio
level_2_quotes
intraday_quotes
Support for Different Asset Types: The public methods correspond to different types of financial assets and provide options to retrieve data specific to those asset types.
Data Transformation and Manipulation: Inside each public method, the corresponding private method is called to retrieve data from the API. The retrieved JSON data is then transformed into pandas DataFrames and manipulated as necessary, including renaming columns, converting data types, setting indexes, and more.
Version Compatibility Check: The is_version_supported method checks if the current version of Bolsuite Web API is compatible with the version supported by the connector. It compares version numbers to determine compatibility.
Overall, this code provides a convenient way to interact with the Bolsuite Web API and fetch various financial market data using Python. It uses popular libraries like requests and pandas to handle API requests and data manipulation efficiently. If you have access to the Bolsuite Web API and want to retrieve financial market data using this connector, you can use the public methods provided by the Connector class.