xiaohongshu
xiaohongshu
kalshi-api-integration
Documentation for integrating with the Kalshi API, covering authentication, market fetching, ticker parsing, and bet placement.
Full skill instructions
Credentials stored in kalshkey (never commit):
API_KEY_ID
PRIVATE_KEY_PEM_CONTENT
Load with:
with open("kalshkey") as f:
api_key_id = f.readline().strip()
private_key = f.read()
from kalshi_python import Configuration, ApiClient, MarketsApi
config = Configuration(host="https://api.elections.kalshi.com/trade-api/v2")
config.api_key['api_key_id'] = api_key_id
config.api_key['private_key'] = private_key_pem
client = ApiClient(configuration=config)
markets_api = MarketsApi(client)
Pattern: SERIES-YYMMDD-AWAYHOME-OUTCOME
Examples:
NBAWIN-250115-LAKBOS-LAK - Lakers to beat CelticsNHLWIN-250115-TORBOS-TOR - Maple Leafs to beat Bruinsparts = ticker.split('-')
# parts[0]: Series (NBAWIN, NHLWIN)
# parts[1]: Date (YYMMDD)
# parts[2]: Teams (AWAYHOME combined)
# parts[3]: Winner team code
Use NamingResolver for consistent team names:
from naming_resolver import NamingResolver
resolver = NamingResolver()
canonical = resolver.resolve("LAL", "nba") # → "Los Angeles Lakers"
def fetch_nba_markets():
"""Fetch open NBA markets from Kalshi."""
response = markets_api.get_markets(
series_ticker="NBAWIN",
status="open",
limit=100
)
return response.to_dict().get("markets", [])
Always save to PostgreSQL, not JSON:
from db_manager import default_db
def save_to_db(sport: str, markets: list):
for market in markets:
# Parse market data
# Insert into game_odds table
default_db.execute("""
INSERT INTO game_odds (game_id, source, yes_price, no_price, ...)
VALUES (:game_id, 'kalshi', :yes_price, :no_price, ...)
ON CONFLICT (game_id, source) DO UPDATE SET ...
""", params)
from kalshi_betting import place_bet
result = place_bet(
ticker="NBAWIN-250115-LAKBOS-LAK",
side="yes", # or "no"
amount=10.00,
limit_price=0.65 # Max price willing to pay
)
plugins/kalshi_markets.py - Market fetchingplugins/kalshi_betting.py - Bet placementplugins/naming_resolver.py - Team name mappingxiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience