Gate Simple Earn Pipeline
SyncGateSimpleEarnWorkflow снимает snapshot Gate Simple Earn из confirmed web API market/list и пишет snapshots в Timescale через SQL ingest.
Компоненты
SyncGateSimpleEarnWorkflow— вызывает Gate Simple Earn overview API, нормализует asset rows и пишет snapshots в Timescale через SQL ingest.internal/worker/models/gate_simple_earn.gointernal/worker/activities/sync_gate_simple_earn.gointernal/worker/workflows/sync_gate_simple_earn.gointernal/db/migrations/00020_gate_simple_earn_snapshot_schema.sqlinternal/db/migrations/00021_gate_simple_earn_aggregates_policies.sql
API Endpoint
GET https://www.gate.com/apiw/v2/uni-loan/earn/market/list
Confirmed request params for overview:
available=falseObserved meaning: do not restrict the list to only currently available products.limit=1000by default Page size for one API request.have_balance=2Observed meaning: do not filter the list by current user balance.have_award=0Observed meaning: do not restrict the list to award-specific products.is_subscribed=0Observed meaning: do not restrict the list to products already subscribed by the current user.sort_business=1Observed meaning: use Gate's default business sorting for the market list.search_type=0Observed meaning: use the default search mode forsearch_coin.page=<n>Page number for pagination.- optional
search_coin=<SYMBOL>Optional asset filter, normalized to uppercase by the activity.
Discovery notes:
- plain
curl https://www.gate.com/simple-earnreturnedAccess Deniedfrom this environment; - browser network inspection confirmed the usable source is
GET /apiw/v2/uni-loan/earn/market/list; - direct HTTP requests from the worker environment became unreliable because Gate started requiring browser-generated session state;
- the current pipeline bootstraps a browser session on
https://www.gate.com/en-us/simple-earnand then callsmarket/listthrough PlaywrightBrowserContext.Request(); - these parameter meanings are based on parameter names and observed response behavior, not on official Gate API documentation.
Mapping
- project = asset row from
data.list - subpool = item from
fixed_listorfixable_list project_coin<= top-levelassetproject_name<= top-levelnamefallback to asset symbolreward_coin<=bonus_assetwhen present, otherwise the staked asset itselfproject_statusaggregates subpool statusessubpool_status:- future
start_time=>Upcoming - past
end_time=>Ended sale_status in (1,2)without ended timing =>Activesale_status_text:1=>Subscribe2=>Sold Out
Detail route is not required for current mapping. The confirmed overview payload already contains embedded fixed_list and fixable_list.
Persistence
ingest_gate_simple_earn_snapshot($1::jsonb)- internal path
/apiw/v2/uni-loan/earn/market/list - source marker
playwright
Tables:
fct_gate_simple_earn_snapshotfct_gate_simple_earn_subpool_snapshotfct_gate_simple_earn_response_snapshotfct_gate_simple_earn_quarantinefct_gate_simple_earn_5minfct_gate_simple_earn_daily
Manual Run
docker compose exec -T temporal-admin-tools temporal workflow start \
--address temporal:7233 --namespace default --task-queue default \
--type SyncGateSimpleEarnWorkflow \
--workflow-id sync-gate-simple-earn-manual-$(date +%s) \
--input '{}'
Verification
- Workflow result counters:
projects_seen,projects_upserted,subpools_seen,subpools_upserted,quarantine_rows - SQL:
SELECT COUNT(*) FROM fct_gate_simple_earn_snapshot;SELECT COUNT(*) FROM fct_gate_simple_earn_subpool_snapshot;SELECT reason, COUNT(*) FROM fct_gate_simple_earn_quarantine GROUP BY reason ORDER BY COUNT(*) DESC;