utils.py
utils
VinterError
get_error_message
staticmethod
It takes in a response and returns an error message
Parameters:
-
response(dict) –The response from the api.
Returns:
-
The error message is being returned.–
Source code in vintersdk/utils.py
VinterUrl
get_active_url
staticmethod
It takes in an asset type and returns a url
Parameters:
-
asset_type(str) –str
Returns:
-
url(str) –The url is being returned.
Raises:
-
ValueError–If the asset type is not in the list of valid asset types.
Source code in vintersdk/utils.py
get_url
staticmethod
It takes in an asset type and a frequency and returns a url
Parameters:
-
asset_type(str) –The type of asset you want to get data for.
-
frequency(str, default:None) –The frequency of the asset you want to get data for., optional
Returns:
-
The url is being returned.–
Source code in vintersdk/utils.py
get_url_by_symbol
staticmethod
It takes in an asset type and a symbol and returns a url
Parameters:
-
asset_type(str) –The type of asset you want to get data for.
-
symbol(str) –The symbol of the asset you want to get data for.
Returns:
-
The url is being returned.–
Source code in vintersdk/utils.py
websocket_url
staticmethod
It takes in an asset type and a frequency and returns a websocket url
Parameters:
-
asset_type(str) –The type of asset you want to get data for.
-
symbol(str, default:None) –The symbol of the asset you want to get data for., optional
Returns:
-
The websocket url is being returned.–
Source code in vintersdk/utils.py
VinterValidation
validate_api_key
staticmethod
If the api key is not a string, then raise a TypeError
Parameters:
-
api_key(str) –The api key to use to get data.
Raises:
-
TypeError–If the api key is not a string.
Source code in vintersdk/utils.py
validate_asset_type
staticmethod
If the asset type is not a valid asset_type , then raise a ValueError
Parameters:
-
asset_type(str) –The type of asset you want to get data for.
Raises:
-
ValueError–If the asset type is not a valid asset type.
Source code in vintersdk/utils.py
validate_dates
staticmethod
It raises a ValueError if any of the dates in the dates list are not in the format YYYY-MM-DD
Parameters:
-
dates(list) –A list of dates in the format YYYY-MM-DD
Raises:
-
ValueError–If any of the dates in the dates list are not in the format YYYY-MM-DD
Source code in vintersdk/utils.py
validate_frequency
staticmethod
If the frequency is not a valid frequency, then raise a ValueError
Parameters:
-
frequency(str) –The frequency of the asset you want to get data for.
Raises:
-
ValueError–If the frequency is not a valid frequency.
Source code in vintersdk/utils.py
validate_symbol_frequency
staticmethod
It takes a string, splits it on the hyphen, and validates the last part of the string
Parameters:
-
symbol(str) –The symbol of the asset you want to get data for.
Returns:
-
A tuple of the symbol and the frequency.–
Source code in vintersdk/utils.py
handle_response
Raises an exception if the request fails
Parameters:
-
response(Response) –The response from the api.
Raises:
-
ValueError–If the request fails.