Search in sources :

Example 1 with DerivativeMetaData

use of org.knowm.xchange.dto.meta.DerivativeMetaData in project XChange by knowm.

the class DeribitExchange method updateExchangeMetaData.

public void updateExchangeMetaData() throws IOException {
    Map<Currency, CurrencyMetaData> currencies = exchangeMetaData.getCurrencies();
    Map<FuturesContract, DerivativeMetaData> futures = exchangeMetaData.getFutures();
    Map<OptionsContract, DerivativeMetaData> options = exchangeMetaData.getOptions();
    List<DeribitCurrency> activeDeribitCurrencies = ((DeribitMarketDataServiceRaw) marketDataService).getDeribitCurrencies();
    currencies.clear();
    futures.clear();
    options.clear();
    for (DeribitCurrency deribitCurrency : activeDeribitCurrencies) {
        currencies.put(new Currency(deribitCurrency.getCurrency()), DeribitAdapters.adaptMeta(deribitCurrency));
        List<DeribitInstrument> deribitInstruments = ((DeribitMarketDataServiceRaw) marketDataService).getDeribitInstruments(deribitCurrency.getCurrency(), null, null);
        for (DeribitInstrument deribitInstrument : deribitInstruments) {
            if (deribitInstrument.getKind() == Kind.future) {
                futures.put(DeribitAdapters.adaptFuturesContract(deribitInstrument), DeribitAdapters.adaptMeta(deribitInstrument));
            } else {
                options.put(DeribitAdapters.adaptOptionsContract(deribitInstrument), DeribitAdapters.adaptMeta(deribitInstrument));
            }
        }
    }
}
Also used : DerivativeMetaData(org.knowm.xchange.dto.meta.DerivativeMetaData) DeribitInstrument(org.knowm.xchange.deribit.v2.dto.marketdata.DeribitInstrument) CurrencyMetaData(org.knowm.xchange.dto.meta.CurrencyMetaData) FuturesContract(org.knowm.xchange.derivative.FuturesContract) OptionsContract(org.knowm.xchange.derivative.OptionsContract) DeribitCurrency(org.knowm.xchange.deribit.v2.dto.marketdata.DeribitCurrency) Currency(org.knowm.xchange.currency.Currency) DeribitCurrency(org.knowm.xchange.deribit.v2.dto.marketdata.DeribitCurrency) DeribitMarketDataServiceRaw(org.knowm.xchange.deribit.v2.service.DeribitMarketDataServiceRaw)

Aggregations

Currency (org.knowm.xchange.currency.Currency)1 DeribitCurrency (org.knowm.xchange.deribit.v2.dto.marketdata.DeribitCurrency)1 DeribitInstrument (org.knowm.xchange.deribit.v2.dto.marketdata.DeribitInstrument)1 DeribitMarketDataServiceRaw (org.knowm.xchange.deribit.v2.service.DeribitMarketDataServiceRaw)1 FuturesContract (org.knowm.xchange.derivative.FuturesContract)1 OptionsContract (org.knowm.xchange.derivative.OptionsContract)1 CurrencyMetaData (org.knowm.xchange.dto.meta.CurrencyMetaData)1 DerivativeMetaData (org.knowm.xchange.dto.meta.DerivativeMetaData)1