期权看涨期权与追踪止损订单条目JAVA Interactive Brokers

时间:2017-04-19 15:43:55

标签: java interactive-brokers ibrokers

尝试构建一个简单的系统,如果上一个交易高于前一个小时柱高,则买入一个看涨期权,或者如果上一个交易低于前一个小时低点买入卖出。当新条目发生时,自动追踪止损位于期权价值的一半。理想情况下,寻找下一个货币期权。

目前这就是我对基础股票的基础:

    Options -Indexes
    RewriteEngine On

    ErrorDocument 404 /error.php
    ErrorDocument 301 /error.php
    ErrorDocument 400 /error.php
    ErrorDocument 401 /error.php
    ErrorDocument 403 /error.php
    ErrorDocument 404 /error.php
    ErrorDocument 500 /error.php


    ###### Send any requests for to error ######
    RewriteRule    ^index(\.[A-Za-z0-9-]+)/?$    error.php    [R=404,NC,L]

    ###### changing Validate URL ########
    RewriteRule    ^validate/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/*?$    validate.php?$1=$2&$3=$4    [NC,L]

    ###### Show 404 error page when any request ends with '.php'
            RewriteRule ^(.*)\.php(.?.*)$ error.php [R=404,NC,L]

    #       I also want to allow for anything that contains a get request here. but wanted to get the .php bit working first.



    ###### To remove the trailing slash ######
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^/]+)/$ $1.php
    RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
    RewriteRule (.*)$ /$1/ [R=301,L]

应该自动输入到期时间作为下一个到期合同

@Override
public void nextValidId(int orderId) {
    System.out.println("id "+orderId);
    nextOrderID = orderId;
    //contract.m_localSymbol = "ESM7";
    Contract c = new Contract ();
    //contract.m_localSymbol = "ESM7";
    c.m_symbol = "SPY";
    c.m_exchange = "SMART";
    c.m_secType = "STK";
    c.m_currency = "USD";

    m_s.reqHistoricalData(1, c, 
    LocalDate.now().format(DateTimeFormatter.BASIC_ISO_DATE)+ " 16:00:00",
            "2 D", "1 day", "MIDPOINT", 1, 1, null);
    m_s.reqMktData(1, c, "", false, null);
    Order order = new Order();
    order.m_action = "BUY";
    order.m_totalQuantity = 1;
    order.m_lmtPrice = 4.00;
    order.m_orderType = "LMT";  
    order.m_account = "11231231";
    Contract contract = new Contract();
    contract.Symbol = "SPY";
    contract.SecType = "OPT";
    contract.Exchange = "BOX";
    contract.Currency = "USD";

    contract.LastTradeDateOrContractMonth = 

应自动输入

        contract.Strike = 
应该自动输入

右(通话/挂号)

        contract.Right =

我不知道该怎么做并下订单。

0 个答案:

没有答案