Skip to content

Commit

Permalink
Merge pull request #4785 from douggie/4769_binance_pm
Browse files Browse the repository at this point in the history
4769 binance pm
  • Loading branch information
timmolter authored Dec 1, 2023
2 parents f23f951 + 8d4a97c commit 444a6d0
Show file tree
Hide file tree
Showing 9 changed files with 691 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,38 @@ public static LocalDateTime toLocalDateTime(String dateTime) {
return LocalDateTime.parse(dateTime, DATE_TIME_FMT);
}

public static String toSymbol(Instrument pair) {
public static String toSymbol(Instrument pair ) {

return toSymbol(pair, false );
}

public static String toInverseSymbol(Instrument pair ) {

return toSymbol(pair, true );
}

public static Boolean isInverse(Instrument pair ) {
if(pair instanceof FuturesContract && pair.getCounter().equals(Currency.USD)){
return true;
} else{
return false;
}

}

public static String toSymbol(Instrument pair, Boolean isInverse ) {
String symbol;

if (pair.equals(CurrencyPair.IOTA_BTC)) {
symbol = "IOTABTC";
} else if(pair instanceof FuturesContract){
symbol = ((FuturesContract) pair).getCurrencyPair().toString().replace("/","");
if(isInverse){
FuturesContract contract = (FuturesContract) pair;
symbol =contract.getCurrencyPair().toString().replace("/", "");
symbol=symbol+"_"+contract.getPrompt();
}else {
symbol = ((FuturesContract) pair).getCurrencyPair().toString().replace("/", "");
}
} else if(pair instanceof OptionsContract) {
symbol = ((OptionsContract) pair).getCurrencyPair().toString().replace("/","");
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ public class BinanceExchange extends BaseExchange implements Exchange {
public static final String SPECIFIC_PARAM_USE_SANDBOX = "Use_Sandbox";
public static final String SPECIFIC_PARAM_USE_FUTURES_SANDBOX = "Use_Sandbox_Futures";
public static final String SPECIFIC_PARAM_FUTURES_ENABLED = "Futures_Enabled";

public static final String SPECIFIC_PARAM_PORTFOLIO_MARGIN_ENABLED = "Portfolio_Margin_Enabled";
private static final String SPOT_URL = "https://api.binance.com";
public static final String FUTURES_URL = "https://fapi.binance.com";
public static final String FUTURES_URL = "https://dapi.binance.com";
public static final String INVERSE_FUTURES_URL = "https://dapi.binance.com";
public static final String PORTFOLIO_MARGIN_URL = "https://papi.binance.com";

public static final String SANDBOX_FUTURES_URL = "https://testnet.binancefuture.com";
protected static ResilienceRegistries RESILIENCE_REGISTRIES;
protected SynchronizedValueFactory<Long> timestampFactory;
Expand Down Expand Up @@ -83,6 +86,12 @@ public boolean isFuturesEnabled(){
exchangeSpecification.getExchangeSpecificParametersItem(SPECIFIC_PARAM_FUTURES_ENABLED));
}

public boolean isPortfolioMarginEnabled(){
return Boolean.TRUE.equals(
exchangeSpecification.getExchangeSpecificParametersItem(SPECIFIC_PARAM_PORTFOLIO_MARGIN_ENABLED));
}


public boolean usingSandbox() {
return enabledSandbox(exchangeSpecification);
}
Expand Down
Loading

0 comments on commit 444a6d0

Please sign in to comment.