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

bn.binancedownload(pairs) raises ERROR: ArgumentError: No symbols found matching SubString{String}["BTC/USDT", "ETH/USDT", "SOL/USDT"] #33

Open
femtotrader opened this issue Apr 16, 2024 · 2 comments

Comments

@femtotrader
Copy link
Contributor

Hello,

Currently following documentation but

julia> using PingPong

julia> @environment!

julia> s = st.strategy(:Example)
Name: Example (Sim)
Config: No Margin, 10.0(USDT)(Base Size), 100.0(USDT)(Initial Cash)
Universe: 3 instances, 1 exchanges
Trades: 0 ~ 0(longs) ~ 0(shorts) ~ 0(liquidations)
Holdings: 0
Pending buys: 0
Pending sells: 0
USDT: 100.0 (on phemex) (Cash)
USDT: 100.0 (Total)

julia> pairs = im.raw.(s.universe.data.asset)
3-element Vector{SubString{String}}:
 "BTC/USDT"
 "ETH/USDT"
 "SOL/USDT"

julia> using Scrapers: Scrapers as scr

julia> const bn = scr.BinanceData
Scrapers.BinanceData

julia> bn.binancedownload(pairs)
ERROR: ArgumentError: No symbols found matching SubString{String}["BTC/USDT", "ETH/USDT", "SOL/USDT"]
Stacktrace:
 [1] binancedownload(syms::Vector{…}; zi::Data.ZarrInstance{…}, quote_currency::String, reset::Bool, kwargs::@Kwargs{})
   @ Scrapers.BinanceData /pingpong/Scrapers/src/binance.jl:239
 [2] binancedownload(syms::Vector{SubString{String}})
   @ Scrapers.BinanceData /pingpong/Scrapers/src/binance.jl:233
 [3] top-level scope
   @ REPL[7]:1
Some type information was truncated. Use `show(err)` to see complete types.
@panbonker
Copy link
Collaborator

scrapers module expects a list of base currencies, and one quote currency see how I do it here:

function symnames(s=Main.s)
String[lowercase(v) for v in (string.(getproperty.(st.assets(s), :bc)))]
end

symbols like "BTC/USDT" are in the ccxt unified scheme regex which is parsed from the exchange market id:

using Exchanges
e = getexchange!(:binance)
e.markets["BTC/USDT:USDT"]["id"]

I made it so you can also pass the ids now

@panbonker
Copy link
Collaborator

it's also possible to download using the Fetch module but downloading 1m candles from exchanges requires lots of calls which is usually slow, maybe it would be better for quickstart to use an Example1D strat that uses 1d timeframes such that one call per asset using fetch_ohlcv is enough, like

# fetch directly from the exchange
# `sandbox=false` because we don't want fake candles
e = getexchange!(exchangeid(s), sandbox=false)
fetch_ohlcv(e, "1d", raw.(s.universe)) # fetches ohlcv candles from the exchange `e`, saves to storage
fill!(s) # fills all the assets in the strategy universe loading candles from storage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants