This is a unofficial wrapper for Vinter.co API
Project description
Unofficial Wrapper for the Vinter API
This is an unofficial wrapper for the Vinter API. It is not affiliated with Vinter in any way.
Installation
pip install vinterunofficial
Documentation
Usage
Valid AssetType
- single_assets
- multi_assets
Get Latest Data
from vinterunofficial import VinterAPI
# vinter = VinterAPI(<APIKEY>, <AssetType>)
vinter = VinterAPI(123456, "single_assets")
selected_symbol = "btc-usd-p-d"
# Get the latest value of the asset
data = vinter.get_latest_data(selected_symbol, limit=1)
# The returned data is a list of dictionaries as shown in the sample response in the documentation
# You can also increase the limit to get more than one value which will return a list ordered by the latest to the oldest
current_price = data[0]["value"]
created_at = data[0]["created_at"]
print("The current price of {} is {} at {}".format(selected_symbol, current_price, created_at))
If you just want the latest value
from vinterunofficial import VinterAPI
vinter = VinterAPI(123456, "single_assets")
selected_symbol = "btc-usd-p-d"
# Get the latest value of the asset
current_price = vinter.get_latest_value(selected_symbol)
print("The current price of {} is {}".format(selected_symbol, current_price))
Get Historical Data (Only Daily Supported)
from vinterunofficial import VinterAPI
# vinter = VinterAPI(<APIKEY>, <AssetType>)
vinter = VinterAPI(123456, "single_assets")
selected_symbol = "btc-usd-p-d"
# Get the latest value of the asset
data = vinter.get_data_by_date(selected_symbol, ["2022-12-04", "2022-12-09"])
for asset in data:
print("The price of {} on {} is {}".format(selected_symbol, asset["created_at"], asset["value"]))
Get All Active Symbols
from vinterunofficial import VinterAPI
single_assets = VinterAPI(123456, "single_assets")
multi_assets = VinterAPI(123456, "multi_assets")
all_active_symbol_multi = [asset["symbol"] for asset in multi_assets.get_all_active_symbols()]
all_active_symbol_single = [asset["symbol"] for asset in single_assets.get_all_active_symbols()]
print("All active symbols for multi assets: {}".format(all_active_symbol_multi))
print("All active symbols for single assets: {}".format(all_active_symbol_single))
Get Contribution of Single Asset
from vinterunofficial import VinterAPI
single_assets = VinterAPI(123456, "single_assets")
selected_symbol = "btc-usd-p-r"
single_asset_contribution = single_assets.get_contribution(selected_symbol)
print("The contribution of {} is {}".format(selected_symbol, single_asset_contribution))
Get Weight of Multi Asset
from vinterunofficial import VinterAPI
multi_assets = VinterAPI(123456, "multi_assets")
selected_symbol = "vnby-bold1-2-d"
multi_asset_weight = multi_assets.get_current_rebalance_weight(selected_symbol)
print("The weight of {} is {}".format(selected_symbol, multi_asset_weight))
Get Next Rebalance Date of Multi Asset
from vinterunofficial import VinterAPI
multi_assets = VinterAPI(123456, "multi_assets")
selected_symbol = "vnby-bold1-2-d"
next_rebalance_date = multi_assets.get_next_rebalance_date(selected_symbol)
print("The next rebalance date of {} is {}".format(selected_symbol, next_rebalance_date))
Get Previous Rebalance Date of Multi Asset
from vinterunofficial import VinterAPI
multi_assets = VinterAPI(123456, "multi_assets")
selected_symbol = "vnby-bold1-2-d"
previous_rebalance_date = multi_assets.get_previous_rebalance_date(selected_symbol)
print("The previous rebalance date of {} is {}".format(selected_symbol, previous_rebalance_date))
Get Next Review Date of Multi Asset
from vinterunofficial import VinterAPI
multi_assets = VinterAPI(123456, "multi_assets")
selected_symbol = "vnby-bold1-2-d"
next_review_date = multi_assets.get_next_review_date(selected_symbol)
print("The next review date of {} is {}".format(selected_symbol, next_review_date))
Get Previous Review Date of Multi Asset
from vinterunofficial import VinterAPI
multi_assets = VinterAPI(123456, "multi_assets")
selected_symbol = "vnby-bold1-2-d"
previous_review_date = multi_assets.get_previous_review_date(selected_symbol)
print("The previous review date of {} is {}".format(selected_symbol, previous_review_date))
Get Next Rebalance Weight of Multi Asset
from vinterunofficial import VinterAPI
multi_assets = VinterAPI(123456, "multi_assets")
selected_symbol = "vnby-bold1-2-d"
next_rebalance_weight = multi_assets.get_next_rebalance_weight(selected_symbol)
print("The next rebalance weight of {} is {}".format(selected_symbol, next_rebalance_weight))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file vinterunofficial-0.0.7.tar.gz
.
File metadata
- Download URL: vinterunofficial-0.0.7.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 726f8d67a38f212aeca79868ec9f3d3e59a27c787147ce68da096feea43622f4 |
|
MD5 | fb986ba2a7533666934b369b594b44fe |
|
BLAKE2b-256 | 08d815b8e31754c71bdc5e437d58a4baa07790563fb3240d20999f67dc0c94f0 |
File details
Details for the file vinterunofficial-0.0.7-py3-none-any.whl
.
File metadata
- Download URL: vinterunofficial-0.0.7-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08b7f3b77c3b3628c23630e8b4b877694e4c55b2e1d838bbc388e45bb13b51d5 |
|
MD5 | 4e1cca8119a1e23618a037d7f6018e70 |
|
BLAKE2b-256 | dbc5400da8e4e0883bce5035fda2b20e9f815eb182d28cbfb9cde5d763d42cd2 |