Initial commit
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
# Auto detect text files and perform LF normalization
|
||||||
|
* text=auto
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
from selenium import webdriver
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
|
from selenium.webdriver.support.ui import WebDriverWait
|
||||||
|
from selenium.webdriver.support import expected_conditions as EC
|
||||||
|
import sys
|
||||||
|
|
||||||
|
LOGIN_URL = "https://edgewonk.app/login"
|
||||||
|
DRIVER_PATH = '/Users/talksik/Downloads/chromedriver'
|
||||||
|
|
||||||
|
driver = webdriver.Chrome(executable_path=DRIVER_PATH)
|
||||||
|
wait = WebDriverWait(driver, 10)
|
||||||
|
|
||||||
|
# Login functionality
|
||||||
|
driver.get(LOGIN_URL)
|
||||||
|
MY_EMAIL = '[email protected]'
|
||||||
|
MY_PASSWORD = '@4kLew2!JG!9FK!'
|
||||||
|
email = driver.find_element_by_id('mat-input-0').send_keys(MY_EMAIL)
|
||||||
|
password = driver.find_element_by_id('mat-input-1').send_keys(MY_PASSWORD)
|
||||||
|
driver.find_element_by_xpath('//button').click()
|
||||||
|
|
||||||
|
# select second account - the one I mainly want to mine
|
||||||
|
second_account = wait.until(
|
||||||
|
EC.presence_of_all_elements_located((By.CSS_SELECTOR, 'button[mat-button]'))
|
||||||
|
)
|
||||||
|
second_account[2].click()
|
||||||
|
print('clicked the second account')
|
||||||
|
|
||||||
|
# go through each account to mine each one as a wrapper for loop
|
||||||
|
# in the future
|
||||||
|
# accounts_list = driver.find_elements_by_xpath('//@mat-button')
|
||||||
|
# print(accounts_list)
|
||||||
|
|
||||||
|
# Navigate to the Journal Page
|
||||||
|
journal_nav = wait.until(
|
||||||
|
EC.presence_of_element_located((By.CSS_SELECTOR, "a[href='/journal']"))
|
||||||
|
)
|
||||||
|
journal_nav.click()
|
||||||
|
print('navigating to the trade journal page')
|
||||||
|
|
||||||
|
|
||||||
|
# Mine each trade in each page
|
||||||
|
# mine each page
|
||||||
|
is_last_page = False
|
||||||
|
while not is_last_page:
|
||||||
|
# mine each trade in the current page
|
||||||
|
driver.implicitly_wait(2) # seconds
|
||||||
|
|
||||||
|
trades_on_this_page = wait.until(
|
||||||
|
EC.presence_of_all_elements_located((By.CSS_SELECTOR, "div.ag-row[role='row'][row-index]"))
|
||||||
|
)
|
||||||
|
|
||||||
|
# if the next page button is disabled, stop
|
||||||
|
is_last_page = wait.until(
|
||||||
|
EC.presence_of_element_located((By.CSS_SELECTOR, "div[ref='btNext']"))
|
||||||
|
)
|
||||||
|
is_last_page = is_last_page.get_attribute('aria-disabled') == 'true'
|
||||||
|
|
||||||
|
for trade_element in trades_on_this_page:
|
||||||
|
# print all data that I need first
|
||||||
|
row_index = trade_element.get_attribute('row-index')
|
||||||
|
print(row_index)
|
||||||
|
|
||||||
|
grid_cells = trade_element.find_elements_by_css_selector("span")
|
||||||
|
# for grid_cell in grid_cells:
|
||||||
|
# print(grid_cell.text())
|
||||||
|
# dump current trade into csv
|
||||||
|
# click on the trade to get more metadata
|
||||||
|
# dump more data that I need
|
||||||
|
# click on cancel
|
||||||
|
|
||||||
|
# navigate to the next page if not the last_page
|
||||||
|
if not is_last_page:
|
||||||
|
next_page_arrow = driver.find_element_by_css_selector("div[ref='btNext']")
|
||||||
|
next_page_arrow.click()
|
||||||
|
print('going to the next page for more trades')
|
||||||
|
else:
|
||||||
|
print('done...last page')
|
||||||
|
|
||||||
|
|
||||||
|
# print(driver.page_source)
|
||||||
|
|
||||||
|
# original_stdout = sys.stdout # Save a reference to the original standard output
|
||||||
|
|
||||||
|
# # output to file in same directory
|
||||||
|
# with open('output.html', 'w') as f:
|
||||||
|
# sys.stdout = f # Change the standard output to the file we created.
|
||||||
|
# print('This message will be written to a file.')
|
||||||
|
# sys.stdout = original_stdout # Reset the standard output to its original value
|
||||||
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
from bs4 import BeautifulSoup
|
||||||
|
import requests
|
||||||
|
import sys
|
||||||
|
|
||||||
|
login_URL = "https://edgewonk.app/login"
|
||||||
|
page = requests.get(login_URL)
|
||||||
|
|
||||||
|
|
||||||
|
print('This message will be displayed on the screen.')
|
||||||
|
|
||||||
|
original_stdout = sys.stdout # Save a reference to the original standard output
|
||||||
|
|
||||||
|
# output to file in same directory
|
||||||
|
with open('output.html', 'w') as f:
|
||||||
|
sys.stdout = f # Change the standard output to the file we created.
|
||||||
|
print('This message will be written to a file.')
|
||||||
|
print(page.text)
|
||||||
|
sys.stdout = original_stdout # Reset the standard output to its original value
|
||||||
+125
@@ -0,0 +1,125 @@
|
|||||||
|
<html>
|
||||||
|
<header>
|
||||||
|
<title>Trade Data</title>
|
||||||
|
</header>
|
||||||
|
<body>
|
||||||
|
<table>
|
||||||
|
<!-- TradingView Widget BEGIN -->
|
||||||
|
<div class="tradingview-widget-container">
|
||||||
|
<div class="tradingview-widget-container__widget"></div>
|
||||||
|
<div class="tradingview-widget-copyright">
|
||||||
|
<a
|
||||||
|
href="https://www.tradingview.com/markets/currencies/forex-heat-map/"
|
||||||
|
rel="noopener"
|
||||||
|
target="_blank"
|
||||||
|
><span class="blue-text">Forex Heat Map</span></a
|
||||||
|
>
|
||||||
|
by TradingView
|
||||||
|
</div>
|
||||||
|
<script
|
||||||
|
type="text/javascript"
|
||||||
|
src="https://s3.tradingview.com/external-embedding/embed-widget-forex-heat-map.js"
|
||||||
|
async
|
||||||
|
>
|
||||||
|
{
|
||||||
|
"width": 770,
|
||||||
|
"height": 400,
|
||||||
|
"currencies": [
|
||||||
|
"EUR",
|
||||||
|
"USD",
|
||||||
|
"JPY",
|
||||||
|
"GBP",
|
||||||
|
"CHF",
|
||||||
|
"AUD",
|
||||||
|
"CAD",
|
||||||
|
"NZD",
|
||||||
|
"CNY"
|
||||||
|
],
|
||||||
|
"isTransparent": false,
|
||||||
|
"colorTheme": "dark",
|
||||||
|
"locale": "en"
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<!-- TradingView Widget END -->
|
||||||
|
|
||||||
|
<!-- TradingView Widget BEGIN -->
|
||||||
|
<div class="tradingview-widget-container">
|
||||||
|
<div id="tradingview_5856a"></div>
|
||||||
|
<div class="tradingview-widget-copyright">
|
||||||
|
<a
|
||||||
|
href="https://www.tradingview.com/symbols/NASDAQ-AAPL/"
|
||||||
|
rel="noopener"
|
||||||
|
target="_blank"
|
||||||
|
><span class="blue-text">AAPL Chart</span></a
|
||||||
|
>
|
||||||
|
by TradingView
|
||||||
|
</div>
|
||||||
|
<script
|
||||||
|
type="text/javascript"
|
||||||
|
src="https://s3.tradingview.com/tv.js"
|
||||||
|
></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
new TradingView.widget({
|
||||||
|
autosize: 'true',
|
||||||
|
symbol: 'NASDAQ:AAPL',
|
||||||
|
interval: '60',
|
||||||
|
timezone: 'Etc/UTC',
|
||||||
|
theme: 'dark',
|
||||||
|
style: '1',
|
||||||
|
locale: 'en',
|
||||||
|
toolbar_bg: '#f1f3f6',
|
||||||
|
enable_publishing: false,
|
||||||
|
allow_symbol_change: true,
|
||||||
|
container_id: 'tradingview_5856a',
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<!-- TradingView Widget END -->
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
DukascopyApplet = {
|
||||||
|
type: 'chart',
|
||||||
|
params: {
|
||||||
|
showUI: true,
|
||||||
|
showTabs: true,
|
||||||
|
showParameterToolbar: true,
|
||||||
|
showOfferSide: true,
|
||||||
|
allowInstrumentChange: true,
|
||||||
|
allowPeriodChange: true,
|
||||||
|
allowOfferSideChange: true,
|
||||||
|
showAdditionalToolbar: true,
|
||||||
|
showDetachButton: true,
|
||||||
|
presentationType: 'candle',
|
||||||
|
axisX: true,
|
||||||
|
axisY: true,
|
||||||
|
legend: true,
|
||||||
|
timeline: true,
|
||||||
|
showDateSeparators: true,
|
||||||
|
showZoom: true,
|
||||||
|
showScrollButtons: true,
|
||||||
|
showAutoShiftButton: true,
|
||||||
|
crosshair: true,
|
||||||
|
borders: false,
|
||||||
|
theme: 'Pastelle',
|
||||||
|
uiColor: '#000',
|
||||||
|
availableInstruments: 'l:',
|
||||||
|
instrument: 'EUR/USD',
|
||||||
|
period: '7',
|
||||||
|
offerSide: 'BID',
|
||||||
|
timezone: 0,
|
||||||
|
live: true,
|
||||||
|
panLock: false,
|
||||||
|
width: '100%',
|
||||||
|
height: '600',
|
||||||
|
adv: 'popup',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<script
|
||||||
|
type="text/javascript"
|
||||||
|
src="https://freeserv-static.dukascopy.com/2.0/core.js"
|
||||||
|
></script>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
This message will be written to a file.
|
||||||
+23
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user