Skip to content

Fill up your car at the lowest possible price in Michigan and beat the Edgeworth Price Cycle!

Notifications You must be signed in to change notification settings

moom0o/GasWatchdog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GasWatchdog

NodeJS SQLite Unirest

Fill up your car at the lowest possible price in Michigan and beat the Edgeworth Price Cycle by recieving notifications when prices are about to skyrocket!

image

Screenshot_20251208-152926

API Requests

Implemented an automatic token rotation system. If the API returns a 403 Forbidden, the script intercepts the error, hits the /refreshToken endpoint using the device fingerprint, updates the in-memory session, and retries the original request without crashing.

graph TD
    %% --- Trigger ---
    Start((Cron Timer)) -->|Every 5m| LoadState[Load Previous Prices]
    LoadState --> ApiReq[POST /map/list]

    subgraph "Authentication System"
    ApiReq --> Status{Status Code?}
    
    Status --403 Forbidden--> Refresh[POST /refreshToken]
    Refresh -->|Using Device/Build ID| SaveToken[Update Token in RAM]
    SaveToken -->|Retry Request| ApiReq
    end

    %% --- Section 2: Data Processing ---
    Status --200 OK--> Transact[Begin SQLite Transaction]
    Transact --> Iterate[Iterate Stations]

    subgraph "Change Detection"
    Iterate --> Compare{Price Changed?}
    
    %% The Optimization: Skip DB if no change
    Compare --No (Skip)--> Next
    
    %% The Update Path
    Compare --Yes--> DeltaCheck{Delta > $0.10?}
    
    DeltaCheck --Yes--> Ping[Webhook: Ping]
    DeltaCheck --No--> Silent[Webhook: Standard Alert]
    
    Ping & Silent --> Insert[Stage DB Update]
    Insert --> Next{More Stations?}
    end

    %% --- Section 3: Persistence ---
    Next --Yes--> Iterate
    Next --No--> Commit[Commit Transaction]
    Commit --> Sleep([Wait for Next Cycle])
Loading

image

Fetch Wesco API to detect gas price increases in Michigan since they love to increase by 50 cents or more overnight due to midwest price cycling

API found by reverse engineering the wesco android app, may add other stations in the future

Once the first price change is detected, you usually have a few hours to get gas before it spikes 50 cents or more at your local station unless the first change happened to be your station.

Web page is experimental/laggy but you can see it at https://gas.moomoo.me

Config options

Nothing should have to be changed besides webhook url unless the API gets updated. The DEVICE UID can be any random string.

About

Fill up your car at the lowest possible price in Michigan and beat the Edgeworth Price Cycle!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors