Skip to main content

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

VinterAPIDocumentation

Usage

Valid AssetType

  • single_assets
  • multi_assets
  • staking_yields

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))

Get Historical Data Between Time Ranges

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_time(symbol=selected_symbol, start="2023-01-01T00:00:00Z", end="2023-01-05T23:59:59Z")
# The returned data is a list of dictionaries as shown in the sample response in the documentation
# You can also increase the limit default is 1000, Max is 2000.
# The returned order will be from oldest to latest so that its easier to loop through start time to get historical data in a paginated api responses.

print(f"The Response : {data}")

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 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_contributions(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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vinterunofficial-0.0.10.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

vinterunofficial-0.0.10-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file vinterunofficial-0.0.10.tar.gz.

File metadata

  • Download URL: vinterunofficial-0.0.10.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for vinterunofficial-0.0.10.tar.gz
Algorithm Hash digest
SHA256 2b922613e24f318a3b63ce1b2d1c528f19e72641bbee7e411c5d05da58c681e5
MD5 8950481e453270e6f5c64f82a1512772
BLAKE2b-256 d10da1f0d05bfb0e1e6262e1ecafb2b5271b90b5dbf890869b020848de348af2

See more details on using hashes here.

File details

Details for the file vinterunofficial-0.0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for vinterunofficial-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 cc2efd424c8b336dd6ce36c5cbd2a98b28868f0050cf6421f5bc613b2dce3a5d
MD5 dc5b9d130257c1a050865020ff2ae84e
BLAKE2b-256 bb68321982ae012799fe67ae20fe31f92b77c9d0bc31dee03b0a1bb60674d80e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page