Git Product home page Git Product logo

Comments (2)

harivansh0 avatar harivansh0 commented on September 4, 2024

did you define dictionary price ={}

from jpmc-tech-task-1.

kirankuyate2157 avatar kirankuyate2157 commented on September 4, 2024

first, think you have to define prieces={}
then while iterating Quotes that time add then stocks with their price
prices[stock] = price
this is a Tab error I think
PS D:\professional work\JpMorgan\JPMC-tech-task-1-py3> python client3.py
File "D:\professional work\JpMorgan\JPMC-tech-task-1-py3\client3.py", line 65
for quote in quotes:
terror: inconsistent use of tabs and spaces in indentation

You can you single space instead of Tabs (tabs may be spaces diff but after single spaces not going to be a problem 👍

Solution
`if name == "main":

# Query the price once every N seconds.
for _ in range(N):
    quotes = json.loads(urllib.request.urlopen(
        QUERY.format(random.random())).read())
    """ ----------- Update to get the ratio --------------- """
    prices = {}
    for quote in quotes:
        stock, bid_price, ask_price, price = getDataPoint(quote)
        prices[stock] = price
        print("Quoted %s at (bid:%s, ask:%s, price:%s)" %
              (stock, bid_price, ask_price, price))

    print("Ratio %s" % (getRatio(prices['ABC'], prices['DEF'])))

`

from jpmc-tech-task-1.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.