question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't Async/Await yahoo_fin api calls

See original GitHub issue

I am using FastAPI and it would seem I can’t directly await the API Calls because I receive this error:

object numpy.float64 can't be used in 'await' expression

It would be very helpful to be able to await these:

            price = await si.get_live_price(symbol)
            chain = await options.get_options_chain(symbol, expiration)[optionType]

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
mpaccionecommented, Sep 18, 2022

Hey, it was incredibly fast. In fact too fast lol. I remember I was using asyncio and making these calls but I believe I was hitting some rate limiting on yahoo. Basically the pages wouldn’t all finish loading.

I decided to keep it how it was sync but then use rabbitmq and batch the requests out to the queue. I this way I was able to get better performance while still having the request content complete to be able to be parsed.

On Sun, Sep 18, 2022, 9:41 AM msingh00 @.***> wrote:

how much faster is it? was thinking of also making some modifications to use modin and ray to see if can make things faster.

— Reply to this email directly, view it on GitHub https://github.com/atreadw1492/yahoo_fin/issues/83#issuecomment-1250333840, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACBIBQQUNOWC7766DKGT6XDV64Z2NANCNFSM5TJBSLQQ . You are receiving this because you authored the thread.Message ID: @.***>

0reactions
alpha-insitecommented, Sep 27, 2022

I am building and MVP so I just went with a queue infrastructure and am relying heavily on redis caching and database for short and long term data. However, I do have computations that can only have 15 minutes max old data so I am a bit hamstrung onto this queue for now. I suppose I could use serverless functions in the future for those but queue is cheap for ideation and I don’t have to fuss around with AWS or DO.

The data is for about 20 years of daily data usually.

I compared performance of:

  1. Simple Python + pandas + parallel processing (concurrent.futures)
  2. Modin (with ray built-in)
  3. Ray + Python

I have settled on the last as its more stable, but yields better performance than plain python multi-processing. I do development on windows (though my servers are hosted linux)…Though it’s great for dealing with large data sets, modin has some stability issues on windows right now - so doing development on windows became a deal breaker. Ray allowed me to get better scaling and performance than standard python + multi-processing. It achieves this i believe by doing something you seem to be doing…using a centralized cache to deal with performance issues related to cross process serialization. At one point they were using redis, but right now i believe they have gotten rid of redis and implemented a custom GCS with optional backing storage (which could still use redis if you like).

Its a very interesting project that i hope gains traction and support.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Async /await not working on making a fetch API call in javascript
I am making a fetch API call from my js file ,I have a doubt that when i am using Async/await still the...
Read more >
How to Easily Call APIs With Fetch and Async/Await in ...
In today's video I'll be showing you how easy it is to call APIs ( REST ) using the Fetch API in JavaScript...
Read more >
Using Async/Await with the Fetch API - JavaScript Tutorial
... you how you can combine the power of Async/Await with the Fetch API to fire off HTTP requests. ... Your browser can't...
Read more >
How to Create an Async API Call with asyncio | Python
Start learning cybersecurity with CBT Nuggets. https://courses.cbt.gg/securityIn this video, Ben Finkel covers how to create an asynchronous ...
Read more >
Why Asynchronous Web API Endpoints | RESTful | async await
This video is part of my web API course, to register the course, please use the link below to get a ... Your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found