Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4769 binance pm #4785

Merged
merged 6 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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