Giter Site home page Giter Site logo

elkd / deriv Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 6.0 74 KB

Playwright Bot to Automate Trading on Deriv. It's a cross-platform Desktop app written in Python, no deployments hustles

Home Page: https://deriv.com

License: MIT License

Python 100.00%
deriv playwright playwright-python trading-bot

deriv's People

Contributors

elkd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

deriv's Issues

[FEATURE REQUEST] Calculate win or loss using balance changes.

Currently, the win/loss calculation is performed by monitoring the trading price span tick changes. That is very error-prone as sometimes the purchase button's clicking event is triggered slower than the speed of price changes, thus unreliable.

But I have noticed as soon as the purchase event is fired, the user's balance is updated instantly before even the purchase contract has been confirmed. If this behavior is proved, then the win/loss can be calculated based on the balance increase or decrease (Increase == win, decrease == loss).

Play after win skips initial stake

There is a very rare case in which, Eg the init stake is 0.35 and martingale is 0.14, the stake for the next play after the win jumps to 0.4 instead of 0.5.

Theoretically, this can happen when the bot fired the play button but deriv website didn't receive the event or blocked the play button but the bot didn't catch any exception, in this case, the bot will go on to calculate the next stake, likely declare loss if the last digit doesn't match and update the stake.

I still don't have an efficient solution to stop this, also it's hard to test as it happens so rarely.

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

There is a known issue with playwright JS having a Memory leak when the same context is used for a long time, depending on the size of JS heap memory available, this issue could occur after 1 hour of running the bot. See this issue

A quick fix could be trying to flush the objects by creating a new context let's say after every 30 minutes. Since state.json is already stored this shouldn't be a very big problem. The current stake, LDP, stop profit/loss also needs to be stored before destroying and recreating a new context.

Playwright sync API isn't compatible with PySimpleGUI event loop

When running pw sync code inside sg loop, pw complains that the blocking code was never awaited and runtime exception is thrown

Traceback (most recent call last): File "/home/el/workspace/contract/deriv/trade.py", line 59, in <module> trade_session.login(values['_EMAIL_'], values['_PWORD_']) File "/home/el/workspace/contract/deriv/session.py", line 23, in login self.page.goto("https://smarttrader.deriv.com/") File "/home/el/workspace/.venv/lib/python3.10/site-packages/playwright/sync_api/_generated.py", line 7328, in goto self._sync( File "/home/el/workspace/.venv/lib/python3.10/site-packages/playwright/_impl/_sync_base.py", line 100, in _sync task = self._loop.create_task(coro) File "/usr/lib/python3.10/asyncio/base_events.py", line 431, in create_task self._check_closed() File "/usr/lib/python3.10/asyncio/base_events.py", line 510, in _check_closed raise RuntimeError('Event loop is closed') RuntimeError: Event loop is closed sys:1: RuntimeWarning: coroutine 'Page.goto' was never awaited

Seems related to this pw issue 178

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.