medovarszki/ibkrfacade

Upgrade to Redis-OM Spring Boot 3.1.3

paulmac opened this issue · 2 comments

Hi Mihaly, I've commited a whole bunch of changes of ibkr to my fork. It is rearranged for Redis-OM style. Read the comments and have a look at the code and see if you agree with what I have done. I do not not use the ContractDetail, it's to cumbersome, I have a class called SimpleContract which contains the 4 or 5 attributes necesary, it is a Redis OM Json object, I could include it and merge with your Option, making it a Json object also if you agree, also there needs to be a client now to implement the ExecHandler interaface for TWs responses. The rest of the changes should be logical for you. Paul.

Hey Paul! Wow, I'm really glad you find this idea interesting and are contributing to its refinement. I'll check your changes in detail in the following days and merge them back if you don't mind.

However, I'll keep the Trend Trading Strategy because it's an important example for understanding the core idea behind the concept.

Hi Mihaly, I am using IBKR facade as a library for my algo trading bot. Therefore I have not commited the skeleton, the initialise data etc. Therefore this branch does not run and can't be tested as is. I can add these artifacts after you have had a look. Again; I don't use ContractDetails nor ContractSamples. I use a SimpleContract redis-om json object :

import com.ib.client.Contract;
@DaTa
@builder
@document
public class SimpleContract {
@id
@indexed
private String id; // ULID
@nonnull
@indexed
private Integer conid;
@nonnull
@indexed
private String symbol; // ("EUR");
@nonnull
@indexed
private Types.SecType secType; // e.g "CFD";
@nonnull
@indexed
private String currency;
private String exchange;

public Contract toContract() {
    Contract con = new Contract();
    con.secType(this.secType.toString());
    con.symbol(this.symbol);
    con.currency(this.currency);
    con.exchange(this.exchange);
    return con;
}

}

I can place this in IBKR facade together with Option which makes sense IMHO

So an Option Contract becomes ....

public class SimpleContract {
@id
@indexed
private String id; // ULID
@nonnull
@indexed
private Integer conid;
private Option option
...
}

JSON allows for contained objects