Skip to content

Instantly share code, notes, and snippets.

@tomas-rampas
Last active October 26, 2024 14:41
Show Gist options
  • Save tomas-rampas/1ff30a914998b284b82cf493ab50a00c to your computer and use it in GitHub Desktop.
Save tomas-rampas/1ff30a914998b284b82cf493ab50a00c to your computer and use it in GitHub Desktop.
Gets List of CompassFx classes per month and year all all for given year
# Define the user agent string
$UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.0.0"
# Define the list of all months
$allMonths = @("january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december")
function Get-CompassWebPage {
param (
[Parameter(Mandatory = $true)]
[string]$Uri,
[Parameter(Mandatory = $true)]
[string]$Username,
[Parameter(Mandatory = $true)]
[SecureString]$Password
)
$plainPassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto(
[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($Password)
)
# Define the login URI and credentials
$loginUri = "https://members.compassfx.com/wp-login.php"
$loginData = @{
"log" = $Username
"pwd" = $plainPassword
"wp-submit" = "Log In"
"redirect_to" = "https://members.compassfx.com/wp-admin/profile.php"
"testcookie" = 1
}
# Create a new web request session
$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
# Perform the login request
try {
$loginResponse = Invoke-WebRequest -Uri "https://members.compassfx.com/wp-login.php" -WebSession $session -Headers @{ "User-Agent" = $Global:UserAgent } -MaximumRedirection 5 -ErrorAction Stop
if(-not($loginResponse.StatusCode -eq 200)) {
Write-Output "Login failed"
}
$loginResponse = Invoke-WebRequest -Uri $loginUri -Method Post -Body $loginData -WebSession $session -Headers @{ "User-Agent" = $Global:UserAgent; "Content-Type" = "application/x-www-form-urlencoded" } -ErrorAction Stop
# Check if login was successful
if ($loginResponse.StatusCode -eq 200) {
Write-Output "Login successful"
# Now make the request to the desired page with the session
$response = Invoke-WebRequest -Uri $Uri -WebSession $session -Headers @{ "User-Agent" = $Global:UserAgent } -MaximumRedirection 5 -ErrorAction Stop
return $response.Content
}
else {
Write-Error "Login failed"
}
}
catch {
Write-Error "Failed to make the request: $_"
}
}
# Prompt the user for their username and password
$month = Read-Host -Prompt "Enter the month (e.g. October or use All)"
$year = Read-Host -Prompt "Enter the year (e.g. 2024)"
$username = Read-Host -Prompt "Enter your username"
$password = Read-Host -Prompt "Enter your password" -AsSecureString
# Check if the month is "All" and get the list of all months
if ($month -eq "All") {
$months = $allMonths
}
else {
$months = @($month)
}
$months | ForEach-Object {
$htmlContent = Get-CompassWebPage "https://members.compassfx.com/sharp-edge-members-area/curriculum/$($_.ToLower())-$($year)/" $username $password
$regexPattern = "(?<=<span class=""eael-accordion-tab-title"">).*?(?=</span>)"
$foundMatches = [regex]::Matches($htmlContent, $regexPattern)
Write-Output "Sessions for $($_):"
foreach ($match in $foundMatches) {
Write-Output $match.Value
}
}
@tomas-rampas
Copy link
Author

tomas-rampas commented Oct 26, 2024

This is how the console output looks like:

PS D:> . \Get-CompassListOfSessions.ps1
Enter the month (e.g. October or use All): April
Enter the year (e.g. 2024): 2024
Enter your username: [email protected]
Enter your password: *******
Sessions for April:
04-02-24 Class – Execution – Rule Based Triggers – VWAP Trap. Imbalance. Press. Fade. (1 hr 39 mins)
04-03-24 Class 1 – Trade Execution Triggers (1 hr 13 mins)
04-03-24 Class 2 – Trade Rules. Book Liquidity. Delta. Value (33 mins)
04-04-24 Class 1 – The RSI of Skews (19 mins)
04-04-24 Class 2 – Structure – GAPS – 123 Point Markup (58 mins)
04-05-24 Class – Macro Lines. Risk Premium. Dispersion. Order Flow Divergence (1 hr 34 mins)
04-08-24 Class 1 – Statistical Arbitrage ALGO’s – Liquidity Hunters – Detectors (56 mins)
04-08-24 Class 2 – Toxic Order Flow – Price Blocks - Imbalances (1 hr 11 mins)
04-09-24 Class 1 – Volatility Bid Ask - Imbalances - Line VWA/VWB (48 mins)
04-09-24 Class 2 – Good Charting = Liquidity Discovery = Toxic (48 mins)
04-09-24 Class 3 – Good Charting Exercise (33 mins)
04-10-24 Class 1 – HFT Predatory Commercial Activity (56 mins)
04-10-24 Class 2 – Charting Market Structure Levels – Buy & Sell Zones (39 mins)
04-11-24 Class – Pricing Your Market – Re-Anchoring Process – Commercial Zones (1 hr 17 mins)
04-12-24 Class 1 – Dealer Keys – Delta Bucket Strategy – Neutral Hedging Algos (28 mins)
04-12-24 Class 2 – Level 1, 2, 3 Price Action Intern Marking Exercise Must Watch (48 mins)
04-12-24 Class 3 – Level 1,2,3 Chart Exercise (17 mins)
04-15-24 Class 1 – Oil 25 Delta Bucket Skew Trade – Momentum Special (29 mins)
04-15-24 Class 2 – “CESI” Fundamentals – “56 Trade” Imbalance (58 mins)
04-16-24 Class – Execution Trade Strategies (1 hr 37 mins)
04-17-24 Class – Understanding COT + MAX5 R Squared (1 hr 17 mins)
04-18-24 Class – 5 Trade Set Ups + NQ Value Lines (1 hr 28 mins)
04-19-24 Class 1 – COT Commercial / Market Makers (1 hr 1 mins)
04-19-24 Class 2 – Fundamentals – FX Statistics (39 mins)
04-22-24 Class – Liquidity – Accumulation Patterns – Belly Fly Equation (1 hr 54 mins)
04-23-24 Class 1 – Rejections – Market Auctions – Liquidity (48 mins)
04-23-24 Class 2 – Rejection Continued (40 mins)
04-24-24 Class – Competitive Auctions – Fundamental Drivers – More MAX (1 hr 39 mins)
04-25-24 Class 1 – Fundamentals – Structure – Rejection (43 mins)
04-25-24 Class 2 – Supply / Demand Trade Techniques (49 mins)
04-26-24 Class 1 – Change of Behavior/Character BOS/CHOCH (1 hr 4 mins)
04-26-24 Class 2 – Absolute Bond Yield Curve (18 mins)
04-26-24 Class 3 – Supply & Demand Volatility Bollinger Band Squeeze (43 mins)
04-29-24 Class 1 – “The Safe Trade” – Liquidity - #56 Trade (52 mins)
04-29-24 Class 2 – Commercial Activity – Safe Trade – Levels - Liquidity (30 mins)
04-30-24 Class - Entries and Execution (1 hr 37 mins)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment