Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.apeindex.trade/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The terminal uses a local SQLite database (apeindex_bot.db). All 14 tables are created automatically on first launch with forward-compatible ALTER TABLE migrations for new columns.
Single-node SQLite. For multi-user horizontal scaling, migration to PostgreSQL is on the roadmap.

Core Tables

users

ColumnTypeDescription
user_idINTEGERTelegram user ID (primary key)
wallet_addressTEXTUser’s Polygon wallet address
encrypted_private_keyTEXTAES-encrypted private key
monitoring_activeBOOLEANWhether monitoring task is running
trading_modeTEXTmanual, auto, paper
risk_levelTEXTlow, medium, high
min_trade_amountREALMinimum trade size in USD
max_trade_amountREALMaximum trade size in USD
paper_balanceREALVirtual paper trading balance (default $10,000)
referral_codeTEXTUser’s unique referral code
timezoneTEXTUser timezone for digest delivery
created_atDATETIMEAccount creation timestamp

positions

ColumnTypeDescription
idINTEGERAuto-increment primary key
user_idINTEGERFK → users
market_idTEXTPolymarket market conditionId
outcomeTEXTYes or No
entry_priceREALPrice at execution
exit_priceREALPrice at exit (null if open)
exit_amountREALAmount received at exit
sizeREALUSD amount invested
stop_lossREALConfigured SL level
take_profitREALConfigured TP level
statusTEXTopen or closed
pnlREALRealised P&L in USD
opened_atDATETIMETrade execution timestamp
closed_atDATETIMEExit timestamp (null if open)

signal_history

ColumnTypeDescription
idINTEGERAuto-increment primary key
user_idINTEGERFK → users
patternTEXTWhich of the 8 patterns fired
market_idTEXTPolymarket market ID
market_questionTEXTHuman-readable question
outcomeTEXTSuggested direction
scoreINTEGERComposite score 1–100
fired_atDATETIMESignal timestamp
resolvedBOOLEANWhether market has resolved

trades

ColumnTypeDescription
idINTEGERAuto-increment primary key
user_idINTEGERFK → users
market_idTEXTMarket ID
outcomeTEXTYes or No
amountREALUSD amount
priceREALExecution price
tx_hashTEXTOn-chain transaction hash
modeTEXTlive or paper
executed_atDATETIMEExecution timestamp

Wallet Tracking Tables

followed_wallets (Follow Wallets — notify only)

ColumnTypeDescription
idINTEGERAuto-increment primary key
user_idINTEGERFK → users
wallet_addressTEXTTracked Polygon address
labelTEXTOptional user-defined label
notifications_enabledBOOLEANPer-wallet toggle
added_atDATETIMEAddition timestamp

copy_wallets (Copy Trade — auto-mirror)

ColumnTypeDescription
idINTEGERAuto-increment primary key
user_idINTEGERFK → users
wallet_addressTEXTWallet to copy
labelTEXTOptional label
copy_enabledBOOLEANPer-wallet enable/disable toggle
last_trade_idTEXTLast processed trade ID (crash recovery)
added_atDATETIMEAddition timestamp

copy_trades

ColumnTypeDescription
idINTEGERAuto-increment primary key
user_idINTEGERFK → users
source_walletTEXTWallet that was copied
market_idTEXTMarket ID
outcomeTEXTYes or No
amountREALUSD amount executed
priceREALExecution price
tx_hashTEXTTransaction hash
modeTEXTlive or paper
executed_atDATETIMEExecution timestamp

Referral Tables

referrals

ColumnTypeDescription
idINTEGERAuto-increment
referrer_user_idINTEGERUser who shared the code
referred_user_idINTEGERUser who joined via the link
joined_atDATETIMEJoin timestamp

referral_earnings

ColumnTypeDescription
idINTEGERAuto-increment
user_idINTEGEREarner
amountREALEarnings in USD
trade_idINTEGERSource trade
created_atDATETIMERecord timestamp

Additional Tables

watchlist

ColumnTypeDescription
user_idINTEGERFK → users
market_idTEXTPolymarket market ID
market_questionTEXTHuman-readable question
entry_priceREALYes price at time of addition
added_atDATETIMEAddition timestamp

paper_positions / paper_trades

Identical schema to positions and trades but isolated for paper trading mode. Use the same SL/TP logic, copy trade execution, and P&L tracking against the virtual $10,000 balance.

alerts

ColumnTypeDescription
idINTEGERAuto-increment
user_idINTEGERFK → users
typeTEXTwatchlist, exit, sl, tp
market_idTEXTRelated market
triggered_atDATETIMEWhen alert fired
notifiedBOOLEANWhether notification was sent

digest_history

ColumnTypeDescription
idINTEGERAuto-increment
user_idINTEGERFK → users
typeTEXTmorning or evening
sent_atDATETIMEDelivery timestamp