Closed topherbuckley closed 1 year ago
@macanudo527 you got it! I overthought that quite a bit it seems. Thanks!
@macanudo527 after fixing a bunch of other fatal errors I was running into, I'm back on to some of these it seems. Right now I'm failing to find the asset 'ARK' on the graph, and the transaction in question is for ARK<->USD on binance some years ago. Looking on coinmarket cap, there doesn't appear to be any market that currently supports this direct conversion any longer. Any recommendations on how to patch for this? I'm guessing this is where your dijkstra graph should come into play, so if you have any hints as to where I should start, or if there is some other way to do a quick hint-hack.
I'll come back to this tomorrow. Thanks in advance for any foresight.
Here is my backtrace btw:
ERROR: Fatal exception occurred:
Traceback (most recent call last):
File "/media/christopher/HDD/git/dali-rp2/src/dali/dali_main.py", line 181, in _dali_main_internal
resolved_transactions: List[AbstractTransaction] = resolve_transactions(transactions, dali_configuration, args.read_spot_price_from_web)
File "/media/christopher/HDD/git/dali-rp2/src/dali/transaction_resolver.py", line 246, in resolve_transactions
transaction = _update_spot_price_from_web(transaction, global_configuration)
File "/media/christopher/HDD/git/dali-rp2/src/dali/transaction_resolver.py", line 136, in _update_spot_price_from_web
conversion: RateAndPairConverter = _get_pair_conversion_rate(
File "/media/christopher/HDD/git/dali-rp2/src/dali/transaction_resolver.py", line 108, in _get_pair_conversion_rate
rate = cast(AbstractPairConverterPlugin, pair_converter).get_conversion_rate(timestamp, from_asset, to_asset, exchange)
File "/media/christopher/HDD/git/dali-rp2/src/dali/abstract_pair_converter_plugin.py", line 182, in get_conversion_rate
historical_bar = self.get_historic_bar_from_native_source(timestamp, from_asset, to_asset, exchange)
File "/media/christopher/HDD/git/dali-rp2/src/dali/plugin/pair_converter/ccxt.py", line 258, in get_historic_bar_from_native_source
raise RP2RuntimeError(f"The asset {from_asset} or {to_asset} is missing from graph")
rp2.rp2_error.RP2RuntimeError: The asset ARK or USD is missing from graph
You just need to add the "entry" market and the Djikstra search will route to your target asset. For example, there is a Binance.com market ARK/BUSD you can add if you have access to Binance.com. I don't remember if you are based in the States or not. Binance.com pricing is unavailable to the States.
You could try adding Upbit if you want to go that route. They have a ARK/KRW market. It seems like ARK is super popular in korea. Adding an exchange is fairly easy. You just need to import the appropriate class from CCXT and declare the stubs in https://github.com/eprbell/dali-rp2/blob/main/src/stubs/ccxt.pyi
Personally, I would try Binance, but if that isn't available Upbit. However, it is a little tricky since I'm guessing you don't actually have access to that exchange and couldn't trade there. It might be hard to justify in an audit.
@macanudo527 thanks for the info! I'll try it out.
I don't remember if you are based in the States or not. Binance.com pricing is unavailable to the States. ... It might be hard to justify in an audit.
Very interesting tangents you brought up there.
I'm currently in the US visiting family for a few months, but a resident of Japan. Last I checked, a year or so ago binance.com had disabled my account for being a US citizen regardless of residency. I had signed up for an account sometime in 2016 if I'm remembering correctly, and it remained largely unused but it seemed this was ok with regulations back then as I never falsified any information about my identity/residency/citizenship. So in summary, I need pricing for an exchange that was ok for me to use at one point, but due to regulatory changes, I am no longer able to access. Maybe this is a question for another forum, (or tax expert), but I'd guess its ok for me to look up the price on binance as I was apparently trading on it when this was still allowed. I don't have any trades on there after the regulations changed.
I would assume others are in a similar situation (i.e. having trades on an exchange like Binance and then were booted due to regulatory changes). I agree that it would look suspicious if you are getting the price from an exchange you are not allowed to access, though one might argue that the price can't be SO different across exchanges. That being said, maybe some sort of input to the configuration file stating date ranges to use certain exchanges where ccxt would use one route during one time period and another during another? Sounds complicated, and I wouldn't have any idea how to approach this, but do you think it is worth opening a discussion on this?
Binance.com's public REST API is unavailable in the states, but it's available in Japan, and most other places whether or not you have an account with them.
You just need access to the public API for ohlcv candles (ie. Pricing data).
This seems resolved via #171
TLDR
Gate.io doesn't support BOBA/USD direct conversion, but it looks like this is manually added to the ccxt.py. |
All the details:
Getting the following error when running the bitbank rest api
For context, the lines around
transaction_resolver.py
(135-148) are as follows:Jumping into
_get_pair_conversion_rate
:Here,
pair_converter
starts as andali.plugin.pair_converter.historic_crypto.PairConverterPlugin
, then moves on to be adali.plugin.pair_converter.ccxt.PairConverterPlugin
. Running along, with thehistoric_crypto.PairConverterPlugin
as thepair_converter' and stepping into
get_conversion_rate`:Here, It appears
self.get_historic_bar_from_native_source(timestamp, from_asset, to_asset, exchange)
is returningNone
so diving into there:The
ValueError
exception is being fired at thehistorical_data = HistoricalData(f"{from_asset}-{to_asset}", seconds, from_timestamp, to_timestamp, verbose=False).retrieve_data()
line. Rerunning that line in the console of VS Code while debugging I see details on the error:And a code snippet from HistoricalData.py:
Here it appears the the HTTP response from coinbase is responding with 200 (success), but the
response.text
is empty, resulting in an empty DataFrame, and then trying to change the column names when there are no columns, results in this Length mismatch error. Maybe this is intentional? Not sure why coinbase would response with success, but with no response.text if this was working as expected, but I'm no HTTP wiz, so maybe this is just how these things work?Moving on, after
HistoricalData.py
loops through all the values oftime_granularity
, and fails each time, we return totransaction_resolver.py
, with this time thepair_converter
beingccxt.PairConverterPlugin
. Stepping into itsget_historic_bar_from_native_source
:As a mental note for this: the
exchange
starts asKraken
, which is supposedly the default, but a theAssetPairAndHistoricalPrice.exchange
value resolves toGate
on the lineexchange=current_markets[(last_node + node)][0],
Now we jump into
hop_bar = self.find_historical_bar(hop_data.from_asset, hop_data.to_asset, timestamp, hop_data.exchange)
and eventually end up here:historical_data = current_exchange.fetchOHLCV(f"{from_asset}/{to_asset}", timeframe, ms_timestamp, 1)
I notice that the code from gate.py doesn't match the one being used in python, so likely dali is using some older version of this? Anyway, there is an exception firing at:
market = self.market(symbol)
The exception being:
This seems to repeat itself until the retry until the
request_count
exceeds 9.