Giter VIP home page Giter VIP logo

trading212api's Introduction

Hey! My name is Ben Timor! :)

// I'm a full stack software developer from Israel Israel Flag.

  • Usually, I develop in JavaScript and TypeScript. And I know what you all think - JavaScript is the worst language in the world. So let me tell you that Hebrew is even worse, And if I could do it when I was 3 years old I can do JavaScript now.

console.log("Hey, Whassup?");

  • Obviously, For backend I use NodeJS. For frontend I usually use React those days although Svelte is also really nice.

<Message> Hey! :) </Message>

  • Python was my first language and I really like it. It's simple, intuitive and fun to code. Almost everytime someone asks me "What language should I learn?", I tell them English. And if they already know English, I tell them to learn Python.

print("It's so amazing I can just write 'print' and use it!")

  • Additionally, I think that Rust is an amazing language and I really hope that companies would adopt it. but I'm not so much of a low-level developer.

!println("I think I'm in love with macros.");

/* Sure, Programming languages are nice. But I'm also a GNU/Linux user (Arch!) and it makes me a pro developer for sure. Trust me. */

A little about some of my projects

Straw project has only two purposes.

  1. I looked for a project that is both easy enough to develop in a programming language which you're new to and advanced enough so you'll be able to learn something in the process.
    Straw is a HTML template engine which allows you to dynamically create HTML pages via Straw language. Straw's code is very similar to modern programming languages, but simpler and sometimes relies on other languages features.
  2. I actually really needed a template engine for my Flask proejcts. HTML is fucking annoying.

Trading212 is an amazing broker. But you know, the first thing that every developer needs when he's looking for a broker is an API.

Because Trading212 doesn't have any official API, I've just developed a selenium based - unofficial one.


Qeres is pretty simple. I've tried to create a simple way to create APIs, But I wanted something a little bit more advanced than REST.

That's where Qeres comes. It's simple, flexible and powerful.


And I have several more projects. Just look at my repositories.

How/Can I contact you?! message

You're more than welcome to send me an email: [email protected]

trading212api's People

Contributors

bentimor avatar pauliusu avatar peterferguson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

trading212api's Issues

HELP

hey guys, can someone help me make this script to work?

Uses the old web app api & has no option to switch to the old app.

setup method fails on a timeout after login since to account-menu-button is no longer a CSS element in the new app.

# Waiting and opening the user menu to avoid the 'You're using CFD' message.
        elem = WebDriverWait(self.driver, self.timeout).until(expected_conditions.element_to_be_clickable((By.CLASS_NAME, "account-menu-button")))
        force_click(elem)

A simple solution (as an intermediary to switching to new api) would be to use the Switch to the old app button as part of setup. The HTML for the button is

<div class="account-menu-item switch-to-old">
  <div class="svg-icon-holder advanced-mode-icon">
    <svg width="32" height="32" viewBox="0 0 32 32">
      <g fill="none" fill-rule="evenodd">
        <path
          fill="#6F6F7F"
          fill-rule="nonzero"
          d="M-0.396446563,2.89644657 C-0.591708707,2.70118442 -0.908291196,2.70118442 -1.10355334,2.89644656 C-1.29881549,3.09170871 -1.29881549,3.4082912 -1.10355335,3.60355334 L3.75000004,8.45710674 L8.60355335,3.60355335 C8.79881549,3.4082912 8.79881549,3.09170871 8.60355335,2.89644657 C8.4082912,2.70118442 8.09170871,2.70118442 7.89644657,2.89644657 L3.75000004,7.04289317 L-0.396446563,2.89644657 Z"
          transform="matrix(0 -1 -1 0 21.354 20.354)"
        ></path>
        <circle cx="16.5" cy="16.5" r="11" stroke="#6F6F7F"></circle>
      </g>
    </svg>
  </div>
  <div class="label">Switch to the old app</div>
</div>

or xpath

/html/body/div[1]/div[10]/div/div/div/div/div/div/div[9]

or css selector

div.account-menu-item:nth-child(9)

or css path

html body div#app.en div.css-cdrhz6.dropdown-animation-enter-done div div.css-p7lmf6.bottom.right.reverse.dropdown-items.account-menu div.dropdown-items-content div.css-1fbss72.scrollable-area-wrapper.bottom div.css-u0d0cr.scrollable-area div.scrollable-items div.account-menu-item.switch-to-old

login not working anymore

the login page now uses email and password fields identified by name
instead of id (as the script is written)

Recent redesign broke API?

New user here, did not use API before T212 redesigned website, so can't be sure that is why API fails for me - whenever I try to get the result of a ticker, I get error:

r = act.result("USCR")
File "/home/user1/.local/lib/python3.8/site-packages/Trading212/api.py", line 179, in result
return float(self.position_info(stock, "ppl"))
File "/home/user1/.local/lib/python3.8/site-packages/Trading212/api.py", line 188, in position_info
return self.driver.find_elements_by_xpath(
IndexError: list index out of range

I did a little experimenting with api.py, and noticed that the section with this label is throwing an exception:

# Navigate to the old app if the new app is opened by default

So, maybe API is ending up on the new site, and can't get to the "old" site? Makes sense that that breaks the code. But the pre-redesign site is still available, at https://live.trading212.com/legacy. But I don't know Selenium to experiment.

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.