hugodanielcom

PureRebalance

hugodanielcom Cập nhật   
Library "PureRebalance"

A rebalance function that is pure.

Depends only on its arguments to perform the necessary calculations.

rebalance(token_price, portfolio_token_amount, portfolio_fiat_amount, rebalance_ratio) Rebalances a portfolio made of tokens and fiat to a given ratio of tokens per fiat
  Parameters:
    token_price: The value of a single unit (1) token
    portfolio_token_amount: The number of tokens in the portfolio
    portfolio_fiat_amount: Fiat available in the portfolio
    rebalance_ratio: The ratio of token value / fiat that the portfolio should have after the rebalance (0.5 is used if no argument is supplied).
  Returns: The number of tokens to buy or sell in order to achieve the desired portfolio ratio passed as argument (a positive value is returned if the tokens are to be bought, and negative value if the tokens are to be sold).
Phát hành các Ghi chú:
v2

Updated:
rebalance(token_price, portfolio_token_amount, portfolio_fiat_amount, rebalance_ratio) Rebalances a portfolio made of tokens and fiat to a given ratio of tokens per fiat
  Parameters:
    token_price: The value of a single unit (1) token
    portfolio_token_amount: The number of tokens in the portfolio
    portfolio_fiat_amount: Fiat available in the portfolio
    rebalance_ratio: The ratio of token value / fiat that the portfolio should have after the rebalance (0.5 is used if no argument is supplied).
  Returns: The number of tokens to buy or sell in order to achieve the desired portfolio ratio passed as argument (a positive value is returned if the tokens are to be bought, and negative value if the tokens are to be sold).
Phát hành các Ghi chú:
v3 - Removed all "simple" arguments

Updated:
rebalance(token_price, portfolio_token_amount, portfolio_fiat_amount, rebalance_ratio) Rebalances a portfolio made of tokens and fiat to a given ratio of tokens per fiat
  Parameters:
    token_price: The value of a single unit (1) token
    portfolio_token_amount: The number of tokens in the portfolio
    portfolio_fiat_amount: Fiat available in the portfolio
    rebalance_ratio: The ratio of token value / fiat that the portfolio should have after the rebalance (0.5 is used if no argument is supplied).
  Returns: The number of tokens to buy or sell in order to achieve the desired portfolio ratio passed as argument (a positive value is returned if the tokens are to be bought, and negative value if the tokens are to be sold).
Thư viện Pine

Với tinh thần TradingView thực sự, tác giả đã xuất bản mã Pine này như một thư viện mã nguồn mở để các lập trình viên Pine khác từ cộng đồng của chúng tôi có thể sử dụng lại nó. Chúc mừng tác giả! Bạn có thể sử dụng thư viện này một cách riêng tư hoặc trong các ấn phẩm mã nguồn mở khác, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy chung.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng thư viện này?

Sao chép văn bản vào khay nhớ tạm và dán nó vào tập lệnh của bạn.