Home Interactive Brokers failure to use Structure throughout file
Reply: 0

Interactive Brokers failure to use Structure throughout file

james storage
1#
james storage Published in 2017-12-06 07:46:28Z

Inside a java application I have a structure inside of a public void that is used like this:

 public void tickPrice(int tickerId, int field, double price, TickAttr attribs) {
        //log.info("tick");
        System.out.println(EWrapperMsgGenerator.tickPrice(tickerId, field, price, attribs));

System.out.println("tickerId = "+tickerId );

System.out.println("tickerIdshowwwwww = "+tickerId );
System.out.println("counter here = "+bothSymbolsList.get(tickerId).orderCounter );
System.out.println("historical here = "+bothSymbolsList.get(tickerId).historicalHigh );

System.out.println("historical here = "+price );


             if (price < bothSymbolsList.get(tickerId).historicalHigh && price > bothSymbolsList.get(tickerId).historicalLow) {
                  System.out.println("FISHINGNGNGNGN ");
                  sendOrder("SELL", tickerId);
                 System.out.println("low= "+bothSymbolsList.get(tickerId).historicalLow +"price "+price+" high = "+bothSymbolsList.get(tickerId).historicalHigh+"0000000000000000000000000000000000");
                }

        }

That would output something like this:

 tickerId = 3
 tickerIdshowwwwww = 3
 counter here = 7
 historical here = 1.18481
 historical here = 1.18235

But when I try and pass the tickerID in a custom made function like this:

  sendOrder("BUY", tickerId);

And try to use it here:

    private void sendOrder(String orderSide, Integer tickerId) {
         System.out.println("min tick = " + bothSymbolsList.get(tickerId).minTick);
    bothSymbolsList.get(tickerId).orderCounter++;
    // TODO forward here specific contract
      System.out.println("min tick flash! = " + bothSymbolsList.get(tickerId));}

I get the following incorrect output:

min tick = 5.0E-5
min tick flash! = apidemo.SymbolStructure@654c8a

The symbol structure file looks like this:

  public class SymbolStructure {
   public String firstSymbol;
   public String secondSymbol;
   public Integer reqId; // tickerId
   public Double historicalHigh;
   public Double historicalLow;
   public Integer orderCounter = 0;
   public Double minTick;
   public String decimalFormat;
   }
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.316189 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO