スキル一覧に戻る
Herklos

trading-backend

by Herklos

My OctoBot stack vscode workspace

0🍴 0📅 2026年1月21日
GitHubで見るManusで実行

SKILL.md


name: trading-backend description: Trading Backend API for OctoBot web/mobile interfaces version: 1.0.0 license: GPL-3.0

trading-backend Development

Overview

Trading Backend provides REST API endpoints for web and mobile interfaces to interact with OctoBot. Handles authentication, real-time data streaming, trading operations, and portfolio management.

References

Key Concepts

Flask Application

RESTful API built with Flask framework.

Authentication

JWT-based authentication for secure access.

OctoBot Bridge

Backend communicates with OctoBot core via internal API.

Common Tasks

Add New Endpoint

from flask import Blueprint, jsonify

api = Blueprint("api", __name__)

@api.route("/portfolio/balance", methods=["GET"])
@require_auth
def get_balance():
    balance = octobot.get_portfolio_balance()
    return jsonify(balance)

Authenticate Requests

from functools import wraps
import jwt

def require_auth(f):
    @wraps(f)
    def decorated(*args, **kwargs):
        token = request.headers.get("Authorization")
        try:
            jwt.decode(token, SECRET_KEY, algorithms=["HS256"])
        except jwt.InvalidTokenError:
            return jsonify({"error": "Unauthorized"}), 401
        return f(*args, **kwargs)
    return decorated

Stream Real-time Data

@api.route("/stream/prices")
def stream_prices():
    def generate():
        while True:
            price = get_current_price()
            yield f"data: {json.dumps(price)}\n\n"
            time.sleep(1)
    
    return Response(generate(), mimetype="text/event-stream")

Integration Points

  • OctoBot Core: Backend calls OctoBot API for operations
  • OctoBot-Trading: Access trading operations
  • Web Interface: Frontend consumes REST API
  • Mobile Apps: Native apps use same API

Quick Reference

Common Endpoints

  • GET /api/portfolio: Portfolio overview
  • POST /api/orders: Place order
  • GET /api/trades/history: Trade history
  • GET /api/config: Bot configuration
  • POST /api/auth/login: Authentication

Error Responses

{
    "error": "Invalid symbol",
    "code": 400,
    "details": "BTC/USD not found"
}

Success Response

{
    "success": true,
    "data": {...}
}

Checklist

  • Secure all endpoints with authentication
  • Implement rate limiting
  • Add CORS headers for web access
  • Document all API routes in OpenAPI/Swagger
  • Test endpoints with Postman/curl
  • Handle OctoBot connection errors
  • Validate all request payloads
  • Log API access for auditing

スコア

総合スコア

50/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です