PINE LIBRARY
업데이트됨 whook

Library "whook"
This library provides functions for generating trading alerts for `whook`
check this -> github.com/germangar/whook
Currently supported exchanges:
Kucoin futures
Bitget futures
Coinex futures
Bingx
OKX futures ( also its demo mode )
Bybit futures ( also Bybit testnet )
Binance futures ( also Binance futures testnet )
Phemex futures ( also Phemex testnet )
Kraken futures ( also Kraken futures testnet )
# --- Test Cases ---
Note: These test cases are for demonstration purposes only and may not cover all scenarios.
// buy(string account, float amount, string unit = "units", float leverage = 1)
buy("MyAccount", 100, "units", 1)
buy("MyAccount", 1000, "USDT", 5)
buy("MyAccount", 50, "percent", 2)
// sell(string account, float amount, string unit = "units", float leverage = 1)
sell("MyAccount", 50, "units", 1)
sell("MyAccount", 500, "USDT", 3)
sell("MyAccount", 25, "percent", 2)
// set_position(string account, float amount, string unit = "units", float leverage = 1)
set_position("MyAccount", 100, "units", 1)
set_position("MyAccount", 1000, "USDT", 5)
set_position("MyAccount", 50, "percent", 2)
// limit_buy(string account, float amount, float price, string unit = "units", float leverage = 1, string id = "")
limit_buy("MyAccount", 100, 10000, "units", 1, "MyBuyOrder")
limit_buy("MyAccount", 1000, 10500, "USDT", 5)
limit_buy("MyAccount", 50, 11000, "percent", 2)
// limit_sell(string account, float amount, float price, string unit = "units", float leverage = 1, string id = "")
limit_sell("MyAccount", 50, 10000, "units", 1, "MySellOrder")
limit_sell("MyAccount", 500, 9500, "USDT", 3)
limit_sell("MyAccount", 25, 9000, "percent", 2)
// close_percent(string account, float pct = 100)
close_percent("MyAccount", 100)
close_percent("MyAccount", 50)
buy(account, amount, unit, leverage)
Sends a trading alert to execute a market buy order.
Parameters:
account (string): The account ID.
amount (float): The amount to buy (can be in USD, units, or percentage).
unit (string): The unit of the amount (optional, defaults to "units").
leverage (float): The leverage to use (optional, defaults to 1x).
sell(account, amount, unit, leverage)
Sends a trading alert to execute a market sell order.
Parameters:
account (string): The account ID.
amount (float): The amount to sell (can be in USD, units, or percentage).
unit (string): The unit of the amount (optional, defaults to "units").
leverage (float): The leverage to use (optional, defaults to 1x).
set_position(account, amount, unit, leverage)
Sends a trading alert to set a position.
Parameters:
account (string): The account ID.
amount (float): The amount to set the position to (can be in USD, units, or percentage).
unit (string): The unit of the amount (optional, defaults to "units").
leverage (float): The leverage to use (optional, defaults to 1x).
limit_buy(account, amount, price, unit, leverage, id)
Sends a trading alert to place a limit buy order.
Parameters:
account (string): The account ID.
amount (float): The amount to buy (can be in USD, units, or percentage).
price (float): The limit price.
unit (string): The unit of the amount (optional, defaults to "units").
leverage (float): The leverage to use (optional, defaults to 1x).
id (string): An optional custom ID for the limit order.
limit_sell(account, amount, price, unit, leverage, id)
Sends a trading alert to place a limit sell order.
Parameters:
account (string): The account ID.
amount (float): The amount to sell (can be in USD, units, or percentage).
price (float): The limit price.
unit (string): The unit of the amount (optional, defaults to "units").
leverage (float): The leverage to use (optional, defaults to 1x).
id (string): An optional custom ID for the limit order.
close_percent(account, pct)
Sends an alert to close a position on Phemex.
Parameters:
account (string): The account ID.
pct (float): The percentage of the position to close (optional, defaults to 100%).
This library provides functions for generating trading alerts for `whook`
check this -> github.com/germangar/whook
Currently supported exchanges:
Kucoin futures
Bitget futures
Coinex futures
Bingx
OKX futures ( also its demo mode )
Bybit futures ( also Bybit testnet )
Binance futures ( also Binance futures testnet )
Phemex futures ( also Phemex testnet )
Kraken futures ( also Kraken futures testnet )
# --- Test Cases ---
Note: These test cases are for demonstration purposes only and may not cover all scenarios.
// buy(string account, float amount, string unit = "units", float leverage = 1)
buy("MyAccount", 100, "units", 1)
buy("MyAccount", 1000, "USDT", 5)
buy("MyAccount", 50, "percent", 2)
// sell(string account, float amount, string unit = "units", float leverage = 1)
sell("MyAccount", 50, "units", 1)
sell("MyAccount", 500, "USDT", 3)
sell("MyAccount", 25, "percent", 2)
// set_position(string account, float amount, string unit = "units", float leverage = 1)
set_position("MyAccount", 100, "units", 1)
set_position("MyAccount", 1000, "USDT", 5)
set_position("MyAccount", 50, "percent", 2)
// limit_buy(string account, float amount, float price, string unit = "units", float leverage = 1, string id = "")
limit_buy("MyAccount", 100, 10000, "units", 1, "MyBuyOrder")
limit_buy("MyAccount", 1000, 10500, "USDT", 5)
limit_buy("MyAccount", 50, 11000, "percent", 2)
// limit_sell(string account, float amount, float price, string unit = "units", float leverage = 1, string id = "")
limit_sell("MyAccount", 50, 10000, "units", 1, "MySellOrder")
limit_sell("MyAccount", 500, 9500, "USDT", 3)
limit_sell("MyAccount", 25, 9000, "percent", 2)
// close_percent(string account, float pct = 100)
close_percent("MyAccount", 100)
close_percent("MyAccount", 50)
buy(account, amount, unit, leverage)
Sends a trading alert to execute a market buy order.
Parameters:
account (string): The account ID.
amount (float): The amount to buy (can be in USD, units, or percentage).
unit (string): The unit of the amount (optional, defaults to "units").
leverage (float): The leverage to use (optional, defaults to 1x).
sell(account, amount, unit, leverage)
Sends a trading alert to execute a market sell order.
Parameters:
account (string): The account ID.
amount (float): The amount to sell (can be in USD, units, or percentage).
unit (string): The unit of the amount (optional, defaults to "units").
leverage (float): The leverage to use (optional, defaults to 1x).
set_position(account, amount, unit, leverage)
Sends a trading alert to set a position.
Parameters:
account (string): The account ID.
amount (float): The amount to set the position to (can be in USD, units, or percentage).
unit (string): The unit of the amount (optional, defaults to "units").
leverage (float): The leverage to use (optional, defaults to 1x).
limit_buy(account, amount, price, unit, leverage, id)
Sends a trading alert to place a limit buy order.
Parameters:
account (string): The account ID.
amount (float): The amount to buy (can be in USD, units, or percentage).
price (float): The limit price.
unit (string): The unit of the amount (optional, defaults to "units").
leverage (float): The leverage to use (optional, defaults to 1x).
id (string): An optional custom ID for the limit order.
limit_sell(account, amount, price, unit, leverage, id)
Sends a trading alert to place a limit sell order.
Parameters:
account (string): The account ID.
amount (float): The amount to sell (can be in USD, units, or percentage).
price (float): The limit price.
unit (string): The unit of the amount (optional, defaults to "units").
leverage (float): The leverage to use (optional, defaults to 1x).
id (string): An optional custom ID for the limit order.
close_percent(account, pct)
Sends an alert to close a position on Phemex.
Parameters:
account (string): The account ID.
pct (float): The percentage of the position to close (optional, defaults to 100%).
릴리즈 노트
v2릴리즈 노트
v3릴리즈 노트
v4Added:
cancel(account, ticker, id)
Sends an alert to cancel a specific limit order.
Parameters:
account (string): The account ID.
ticker (string)
id (string): The ID of the limit order to cancel.
cancel_all(account, ticker)
Sends an alert to cancel all orders for a symbol.
Parameters:
account (string): The account ID.
ticker (string)
Updated:
buy(account, ticker, amount, unit, leverage)
Sends a trading alert to execute a market buy order.
Parameters:
account (string): The account ID.
ticker (string)
amount (float): The amount to buy (can be in USD, units, or percentage).
unit (string): The unit of the amount (optional, defaults to "units").
leverage (float): The leverage to use (optional, defaults to 1x).
sell(account, ticker, amount, unit, leverage)
Sends a trading alert to execute a market sell order.
Parameters:
account (string): The account ID.
ticker (string)
amount (float): The amount to sell (can be in USD, units, or percentage).
unit (string): The unit of the amount (optional, defaults to "units").
leverage (float): The leverage to use (optional, defaults to 1x).
set_position(account, ticker, amount, unit, leverage)
Sends a trading alert to set a position.
Parameters:
account (string): The account ID.
ticker (string)
amount (float): The amount to set the position to (can be in USD, units, or percentage).
unit (string): The unit of the amount (optional, defaults to "units").
leverage (float): The leverage to use (optional, defaults to 1x).
limit_buy(account, ticker, amount, price, unit, leverage, id)
Sends a trading alert to place a limit buy order.
Parameters:
account (string): The account ID.
ticker (string)
amount (float): The amount to buy (can be in USD, units, or percentage).
price (float): The limit price.
unit (string): The unit of the amount (optional, defaults to "units").
leverage (float): The leverage to use (optional, defaults to 1x).
id (string): An optional custom ID for the limit order.
limit_sell(account, ticker, amount, price, unit, leverage, id)
Sends a trading alert to place a limit sell order.
Parameters:
account (string): The account ID.
ticker (string)
amount (float): The amount to sell (can be in USD, units, or percentage).
price (float): The limit price.
unit (string): The unit of the amount (optional, defaults to "units").
leverage (float): The leverage to use (optional, defaults to 1x).
id (string): An optional custom ID for the limit order.
close_percent(account, ticker, pct, price)
Sends an alert to close a position on Phemex.
Parameters:
account (string): The account ID.
ticker (string)
pct (float): The percentage of the position to close (optional, defaults to 100%).
price (float)
파인 라이브러리
트레이딩뷰의 진정한 정신에 따라, 작성자는 이 파인 코드를 오픈소스 라이브러리로 게시하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 경의를 표합니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈소스 게시물에서 사용할 수 있지만, 이 코드의 게시물 내 재사용은 하우스 룰에 따라 규제됩니다.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
파인 라이브러리
트레이딩뷰의 진정한 정신에 따라, 작성자는 이 파인 코드를 오픈소스 라이브러리로 게시하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 경의를 표합니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈소스 게시물에서 사용할 수 있지만, 이 코드의 게시물 내 재사용은 하우스 룰에 따라 규제됩니다.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.