Skip to content

Commit

Permalink
Merge pull request #4912 from rizer1980/PR/bybit-concurrent-fix
Browse files Browse the repository at this point in the history
[BYBIT] concurrent fix
  • Loading branch information
timmolter authored Aug 16, 2024
2 parents 2908701 + 750b814 commit 6db82a3
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@

public class BybitAdapters {

private static final SimpleDateFormat OPTION_DATE_FORMAT = new SimpleDateFormat("ddMMMyy", Locale.US);
private static final ThreadLocal<SimpleDateFormat> OPTION_DATE_FORMAT = ThreadLocal.withInitial(
() -> new SimpleDateFormat("ddMMMyy"));
public static final List<String> QUOTE_CURRENCIES = Arrays.asList("USDT", "USDC", "EUR", "BTC", "ETH", "DAI", "BRZ");

public static Wallet adaptBybitBalances(List<BybitCoinWalletBalance> coinWalletBalances) {
Expand Down Expand Up @@ -133,7 +134,7 @@ public static String convertToBybitSymbol(Instrument instrument) {
return String.format(
"%s-%s-%s-%s",
optionsContract.getBase(),
OPTION_DATE_FORMAT.format(optionsContract.getExpireDate()),
OPTION_DATE_FORMAT.get().format(optionsContract.getExpireDate()),
optionsContract.getStrike(),
optionsContract.getType().equals(OptionsContract.OptionType.PUT) ? "P" : "C")
.toUpperCase();
Expand Down Expand Up @@ -191,7 +192,7 @@ public static Instrument adaptInstrumentInfo(BybitInstrumentInfo instrumentInfo)
return new OptionsContract.Builder()
.currencyPair(
new CurrencyPair(instrumentInfo.getBaseCoin(), instrumentInfo.getQuoteCoin()))
.expireDate(OPTION_DATE_FORMAT.parse(expireDateString))
.expireDate(OPTION_DATE_FORMAT.get().parse(expireDateString))
.strike(strike)
.type(
optionInstrumentInfo.getOptionsType().equals(OptionType.CALL)
Expand Down

0 comments on commit 6db82a3

Please sign in to comment.