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));
}
}
}
}
Aggregations