4 registered members (ozgur, Ayumi, VHX, monarch),
1,161
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Help with developing BTCUSDT Open Interest Indicator
#484739
12/07/21 13:29
12/07/21 13:29
|
Joined: Jul 2021
Posts: 52
degenerate_762
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2021
Posts: 52
|
Hi, I trade Crypto currency futures on binance futures exchange. I am trying to program an open interest indicator. I have found this sample code from the zorro forum and can see that contractVal and contractVol have been scripted. I have changed the BarPeriod to 1. Could you please provide directions on how i can complete this simple task?
#include <r.h>
#include <contract.c>
void run()
{
BarPeriod = 1;
Multiplier = 100;
contractUpdate("BTCUSDT",1,CALL|PUT);
int Type = PUT; // Then change to CALL to see difference ******
var delta_check = 0;
var strike_price = 0;
var con_value;
var current_IV;
var Dividend = 0.02;
var HistVolOV = VolatilityOV(20);
var InterestV = 0.01*yield();
strike_price = priceClose();
CONTRACT* dtest = contract(Type,30,strike_price);
con_value = contractVal(dtest,priceClose(),HistVolOV,Dividend,InterestV,&delta_check);
current_IV = contractVol(dtest,priceClose(),HistVolOV,con_value,Dividend,InterestV);
}
|
|
|
Re: Help with developing BTCUSDT Open Interest Indicator
[Re: degenerate_762]
#484748
12/07/21 15:24
12/07/21 15:24
|
Joined: Jul 2021
Posts: 52
degenerate_762
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2021
Posts: 52
|
From the Online Manual
contractVol (CONTRACT*, var Price, var HistVol, var Value, var Dividend, var RiskFree): var
Returns the implied volatility (IV) of the given option contract with the given Value. For the parameters, see contractVal. The function uses R and the RQuantLib package; both must be installed on the trading PC (see remarks below). Source code in contract.c. The implied volatility is an estimate of the future volatility of the underlying, based on the current option parameters. If the contract has no value or if the strike price is too far or on the wrong side of the asset price, the function returns 0. Fine and good that the implied volatility or open interest is a variable. It means that it can be easily plotted using the plot function.
contract (int Type, int Expiry, var Strike): CONTRACT*
var Price = priceClose();
var HistVol = VolatilityOV(20);
var Value = ?
var Dividend = 0.02;
var RiskFree = 0.01*yield();
Need further directions please.
|
|
|
Re: Help with developing BTCUSDT Open Interest Indicator
[Re: degenerate_762]
#484750
12/07/21 16:05
12/07/21 16:05
|
Joined: Feb 2017
Posts: 1,731 Chicago
AndrewAMD
Serious User
|
Serious User
Joined: Feb 2017
Posts: 1,731
Chicago
|
What option contract? Those are futures contracts, not option contracts. Also, Petra is correct: If BinanceFutures supports OI then it's in the ContractVal variable. But it is not mentioned in the documentation, so you probably get no OI for binance futures.
|
|
|
|