since we now have access to Python via Amibroker we can now also use the Python IBAPI.
I am no specialist but there is a lot to be found on the net. So I made a small code that gives you an idea how to access this information you need via the use of the Python plugin. I assume you have Python installed and know how it works. You need to install the "ibapi" (pip install ibapi in the command window). I also use another library i found on the net called ib_insync. So if you have it all installed and press the Param window button "Get Smallest Increment". The output information is printed in the Title of your Amibroker window. So I did not work it out but I just show that it is possible to get this information.
In the example code I retrieve the increment for the June contract of ES futures
so then the AFL test file looks like:
PyLoadFromFile( "IBSmallestIncrement", "C:\\Users\\win 10\\AppData\\Local\\Programs\\Python\\Python38\\mypython\\ib\\ibtest1.py" );
trig1 = ParamTrigger( "Trig1", "Get Smallest Increment" );
trig2 = ParamTrigger( "Trig2", "Clear" );
if( trig2 )
{
StaticVarSetText( "output", "" );
}
if( trig1 )
{
StaticVarSetText( "output", "" );
outputArray = PyEvalFunction( "IBSmallestIncrement", "getSmallestIncrement" );
StaticVarSetText( "output", outputArray );
}
Plot( C, "", colorWhite, styleCandle );
output = StaticVarGetText( "output" );
Title = "Output: " + output;
and the Python file looks like
'''
pip install ibapi
pip install ib_insync
for ib_insync see: https://docplayer.net/178553718-Ib_insync-release-ewald-de-wit-feb-18-2020.html
examples
Contract(conId=270639)
Stock('AMD', 'SMART', 'USD')
Stock('INTC', 'SMART', 'USD', primaryExchange='NASDAQ')
Forex('EURUSD')
CFD('IBUS30')
Future('ES', '20180921', 'GLOBEX')
Option('SPY', '20170721', 240, 'C', 'SMART')
Bond(secIdType='ISIN', secId='US03076KAA60')
'''
import ibapi
from ib_insync import *
import asyncio
#def getSmallestIncrement( contract, exchange, type, currency, date ):
def getSmallestIncrement():
# connect to TWS
asyncio.set_event_loop(asyncio.new_event_loop())
ib = IB()
ib.connect('127.0.0.1', 7496, clientId=1)
# con = Forex('EURUSD')
# con = Stock('AMD', 'SMART', 'USD')
con = Future('ES', '20210618', 'GLOBEX')
cd = ib.reqContractDetails(con)[0]
# print(cd.marketRuleIds)
rules = [ib.reqMarketRule(ruleId)
for ruleId in cd.marketRuleIds.split(',')]
ib.disconnect()
listToStr = ' '.join(map(str, rules))
return listToStr