Skip to content

Instantly share code, notes, and snippets.

@mistermichaelll
Created July 28, 2020 02:34
Show Gist options
  • Save mistermichaelll/7d6cb085000adf8c33087df3ae1b3a40 to your computer and use it in GitHub Desktop.
Save mistermichaelll/7d6cb085000adf8c33087df3ae1b3a40 to your computer and use it in GitHub Desktop.
This is necessary for the other piece of my script.
# ====================================================================
# ----------------
# APEX Information
# ----------------
# This script simply defines the urls of the information that we need
# exported out of APEX.
#
# Note that the cost basis URLs access APEX's API. This means that
# we only have to open these pages in Selenium in order to export this
# information.
#
# ====================================================================
# account information
# -------------------
m1_account_number = "" # your M1 account number
user = "" # your APEX username
password = "" # APEX password
# info to clean up our code
# --------------------------
initial_login_xpath = "/html/body/div/div/div/main/div/div/div[2]/div/form/button"
username_xpath = "/html/body/div/div/div/main/div/div/div[4]/div[1]/form/div[1]/input"
password_xpath = "/html/body/div/div/div/main/div/div/div[4]/div[1]/form/div[2]/input"
login_button_xpath = "/html/body/div/div/div/main/div/div/div[4]/div[1]/form/button"
# some future-proofing
# --------------------
from datetime import datetime
todays_date = datetime.today().strftime("%Y-%m-%d")
two_year_limit = "2019-01-01"
# APEX urls
apex_login_url = 'https://public-apps.apexclearing.com/session/#/login/'
positions_export_url = 'https://public-apps.apexclearing.com/accounts/#/' + m1_account_number + '/positions'
activity_export_url = 'https://public-apps.apexclearing.com/accounts/#/' + m1_account_number + '/activity?startDate=' + two_year_limit + '&endDate=' + todays_date +'&skipSearch=true&activityType=MONEY_MOVEMENTS'
cost_basis_open_url = 'https://public-api.apexclearing.com/taxman/api/v1/gainloss/reports/' + m1_account_number + '/unrealized?fromdate=19000101'
cost_basis_closed_url = 'https://public-api.apexclearing.com/taxman/api/v1/gainloss/reports/' + m1_account_number +'/realized?fromdate=19000101'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment