Skip to content

Commit

Permalink
Removed deprecated driver manager, update history and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
HellAmbro committed Nov 15, 2023
1 parent c738242 commit ad4b3e4
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 15 deletions.
3 changes: 3 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### v0.2.6
* removed depreacted driver manager
* fix cfd/equity switch
### v0.2.5

* Support CFD
Expand Down
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ For a full reference please look inside **examples** folder
```python
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

from pytrading212 import Equity
from pytrading212 import Mode, EquityOrder, OrderType

driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver = webdriver.Chrome(service=Service())
equity = Equity(email='your_email', password='your_password', driver=driver, mode=Mode.DEMO)

# Invalid order: voluntary typo-error in instrument code
order = EquityOrder(instrument_code="AAAAPL_US_EQ", order_type=OrderType.MARKET, quantity=2)
is_valid, reason = equity.check_order(order)
if is_valid:
print("Your order is valid, can be executed.")
Expand All @@ -84,12 +84,11 @@ equity.finish()
```python
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

from pytrading212 import CFD, CFDOrder, CFDMarketOrder
from pytrading212 import CFD, CFDOrder
from pytrading212 import Mode

driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver = webdriver.Chrome(service=Service())
cfd = CFD(email='your_email', password='your_password', driver=driver, mode=Mode.DEMO)

instrument_code = "AAPL"
Expand All @@ -111,14 +110,14 @@ print(cfd.execute_order(order=cfd_order))
PyTrading212 **Equity** instance

```python
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver = webdriver.Chrome(service=Service())
equity = Equity(email='your_email', password='your_password', driver=driver, mode=Mode.DEMO)
```

PyTrading212 **CFD** instance

```python
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver = webdriver.Chrome(service=Service())
cfd = CFD(email='your_email', password='your_password', driver=driver, mode=Mode.DEMO)
```

Expand Down
2 changes: 1 addition & 1 deletion examples/cfd_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"config = configparser.ConfigParser()\n",
"config.read('../config.ini')\n",
"\n",
"driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))\n",
"driver = webdriver.Chrome(service=Service())\n",
"cfd = CFD(email=config['ACCOUNT']['email'], password=config['ACCOUNT']['password'], driver=driver, mode=Mode.DEMO)"
],
"metadata": {
Expand Down
3 changes: 1 addition & 2 deletions examples/cfd_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

from pytrading212 import CFD, CFDMarketOrder, CFDLimitStopOrder, CFDOCOOrder
from pytrading212 import Mode

config = configparser.ConfigParser()
config.read('../config.ini')

driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver = webdriver.Chrome(service=Service())
cfd = CFD(email=config['ACCOUNT']['email'], password=config['ACCOUNT']['password'], driver=driver, mode=Mode.DEMO)

# Instrument code
Expand Down
2 changes: 1 addition & 1 deletion examples/equity_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"config = configparser.ConfigParser()\n",
"config.read('../config.ini')\n",
"\n",
"driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))\n",
"driver = webdriver.Chrome(service=Service())\n",
"equity = Equity(email=config['ACCOUNT']['email'], password=config['ACCOUNT']['password'], driver=driver, mode=Mode.DEMO)"
],
"metadata": {
Expand Down
4 changes: 1 addition & 3 deletions examples/equity_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

from pytrading212 import Equity
from pytrading212 import Mode, EquityOrder, OrderType


config = configparser.ConfigParser()
config.read('../config.ini')

driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver = webdriver.Chrome(service=Service())
equity = Equity(email=config['ACCOUNT']['email'], password=config['ACCOUNT']['password'], driver=driver, mode=Mode.DEMO)

# Invalid order: voluntary typo-error in instrument code
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="pytrading212",
version="0.2.5",
version="0.2.6",
author="HellAmbro",
author_email="[email protected]",
description="Unofficial Trading212 API",
Expand Down

0 comments on commit ad4b3e4

Please sign in to comment.