Open pietervandessel opened 1 year ago
Hi,
Thank you for the great package.
I received the same error - binance changed the "PERCENT_PRICE" filter into "PERCENT_PRICE_BY SIDE". Rerun the formula by replacing the term turned into the following error:
"Error in [.data.table
(filters, filterType == "PERCENT_PRICE_BY_SIDE", :
j (the 2nd argument inside [...]) is a single symbol but column name 'multiplierDown' is not found. Perhaps you intended DT[, ..multiplierDown]. This difference to data.frame is deliberate and explained in FAQ 1.1."
Most probably this is due to the second change in the API: multiplierUp was divided into: bidMultiplierUp, askMultiplierUp, and multiplierDown was divided into: bidMultiplierDown, askMultiplierDown
Interestingly, manual change of the formula with respect to the changes above did not affect the error mentioned by @pietervandessel.
Even removing manually all "stopifnot" statements and testing a BUY LIMIT path did not affect the result:
"Error in if (filters[filterType == "PERCENT_PRICE", avgPriceMins] == 0) { : argument is of length zero"
It seems like another part of the package is pointing at the filterType == "PERCENT_PRICE".
Test-changes to the formula are given below:
"f_binance_new_order <- function (symbol , side = c("BUY", "SELL") , type = c("LIMIT", "MARKET", "STOP_LOSS", "STOP_LOSS_LIMIT", "TAKE_PROFIT", "TAKE_PROFIT_LIMIT", "LIMIT_MAKER") , time_in_force = c("GTC", "IOC", "FOK") , quantity , price , stop_price , iceberg_qty , test = TRUE) { filterType <- minQty <- maxQty <- stepSize <- applyToMarket <- avgPriceMins <- limit <- NULL minNotional <- minPrice <- maxPrice <- tickSize <- bidMultiplierDown <- bidMultiplierUp <- askMultiplierDown <- askMultiplierUp <- NULL side <- match.arg(side) type <- match.arg(type)
params <- list(symbol = symbol, side = side, type = type, quantity = quantity, price = price)
if (isTRUE(test)) {
message("TEST")
ord <- binance_query(endpoint = "api/v3/order/test", method = "POST", params = params, sign = TRUE)
if (is.list(ord) & length(ord) == 0) {
ord <- "OK"
}
}
else {
ord <- binance_query(endpoint = "api/v3/order", method = "POST", params = params, sign = TRUE)
ord$fills <- NULL
ord <- as.data.table(ord)
for (v in c("price", "origQty", "executedQty", "cummulativeQuoteQty")) {
ord[, :=
((v), as.numeric(get(v)))]
}
for (v in c("transactTime")) {
ord[, :=
((v), as.POSIXct(get(v)/1000, origin = "1970-01-01"))]
}
setnames(ord, to_snake_case(names(ord)))
}
data.table(ord)
}
environment(f_binance_new_order) <- asNamespace('binancer') assignInNamespace("binance_new_order", f_binance_new_order, ns = "binancer")"
@daroczig Any idea on how to fix this issue otherwise? Thank you very much in advance!
I've just saw @stanyip's PR at #32 that might fix the above -- can you folks pls check and report back?
Thank you! Problem solved.
Hi, I get the following error when creating a new order (e.g.: binance_new_order("XRPUSDT", side = "BUY", type = "LIMIT", price=0.32, quantity = 60, time_in_force = "GTC", test=F):
"Error in if (filters[filterType == "PERCENT_PRICE", avgPriceMins] == 0) { : argument is of length zero"
If I run: filters <- binance_filters("XRPUSDT"), I can see that filterType has the value PERCENT_PRICE_BY_SIDE but not PERCENT_PRICE