Coder Social home page Coder Social logo

Comments (4)

garethdmm avatar garethdmm commented on August 30, 2024

This is likely because market_order(mode, volume) doesn't have a reasonable default implementation in ExchangeAPIWrapper yet. Individual integrations can override it if their exchange does have a market order order type, but we just haven't coded the default such that it'll work on any exchange.

Such an implementation would be as simple as: get current orderbook, get price quote for desired volume, place limit order at that price. Here's where it would go:

def market_order(self, mode, volume):
"""
Place a market order on the exchange.
"""
return self.place_order(mode, volume, order_type=order_types.MARKET_ORDER)

from gryphon.

asmodehn avatar asmodehn commented on August 30, 2024

Thanks I ll have a look at that eventually, I'm in need of more order types and need to understand this part better...

from gryphon.

asmodehn avatar asmodehn commented on August 30, 2024

Hmmm, I might be wrong but it looks like even if the exchange integration has different order methods following the api_wrapper design, it will not be called by the coordinator ?

Looks like both market_order() and limit_order() from the exchange are calling the place_order() from the exchange api integration :
https://github.com/garethdmm/gryphon/blob/master/gryphon/execution/harness/exchange_coordinator.pyx#L355

Maybe this needs some careful api changes if one is to implement more order types (market without price, stop loss are the ones I'm missing currently...)

from gryphon.

asmodehn avatar asmodehn commented on August 30, 2024

This might also be an opportunity to check and get closer to what ccxt does : https://github.com/ccxt/ccxt/blob/master/python/ccxt/base/exchange.py#L1608

from gryphon.

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.