brtr / twitter-gpt

0 stars 0 forks source link

请给我们的gpts 的插件增加历史数据的获取 #4

Open iannono opened 3 months ago

iannono commented 3 months ago

目前我们通过 coinmarket cap 只能获得 1 个月内的数据。 我们希望能够获取到更早的数据, 可以通过我们自己的 position 的项目获取到。

但是如何在 gpts 里面支持多个 api, 需要弄明白怎么使用, 或者我们通过我们自己的 api, 集成进 coinmarket cap 也是可以的。

我们自己的 coin 数据拉取记录来自: https://github.com/brtr/coin_elite 这个项目

下面是我目前在 gpts 里面创建的 actions, 调用的是 coinmarket cap 的 api, 请做进一步的实现

https://chat.openai.com/g/g-VnVpO5spV-crypto-quant-expert

openapi: 3.0.0
info:
  title: CoinMarketCap API
  version: "1.0"
servers:
  - url: https://pro-api.coinmarketcap.com
paths:
  /v2/cryptocurrency/quotes/latest:
    get:
      summary: Get the latest cryptocurrency market quotes.
      operationId: getLatestQuotes
      parameters:
        - in: query
          name: symbol
          required: true
          schema:
            type: string
          description: The symbol of the cryptocurrency to get the latest market quote for.
        - in: query
          name: convert
          schema:
            type: string
          description: The fiat currency or cryptocurrency to convert the market quotes into.
      responses:
        '200':
          description: Successful response with the latest market quotes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LatestQuotesResponse'
      security:
        - apiKeyAuth: []
  /v3/cryptocurrency/quotes/historical:
    get:
      summary: Get historical market quotes for a cryptocurrency on a specific date.
      operationId: getHistoricalQuotes
      parameters:
        - in: query
          name: symbol
          required: true
          schema:
            type: string
          description: The symbol of the cryptocurrency to get historical market quotes for.
        - in: query
          name: time_start
          schema:
            type: string
            format: date
          description: Timestamp (Unix or ISO 8601) to start returning quotes for.
        - in: query
          name: time_end
          schema:
            type: string
            format: date
          description: Timestamp (Unix or ISO 8601) to stop returning quotes for (inclusive).
        - in: query
          name: count
          schema:
            type: number
          description: The number of interval periods to return results for.
        - in: query
          name: interval
          schema:
            type: string
            default: "daily"
          description: Interval of time to return data points for.
        - in: query
          name: convert
          schema:
            type: string
          description: The fiat currency or cryptocurrency to convert the historical market quotes into.
      responses:
        '200':
          description: Successful response with the historical market quotes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HistoricalQuotesResponse'
      security:
        - apiKeyAuth: []
  /v1/cryptocurrency/trending/latest:
    get:
      summary: Get the latest trending cryptocurrencies.
      operationId: getTrendingCryptocurrencies
      parameters:
        - in: query
          name: start
          schema:
            type: integer
          description: The starting index for the returned cryptocurrencies list.
        - in: query
          name: limit
          schema:
            type: integer
          description: The number of cryptocurrencies to return. Optionally specify the number of results to return. Use this parameter and the "start" parameter to determine your own pagination size.
        - in: query
          name: time_period
          schema:
            type: string
            default: "24h"
          description: The starting index for the returned cryptocurrencies list.
        - in: query
          name: convert
          schema:
            type: string
          description: The fiat currency or cryptocurrency to convert the market quotes into.
      responses:
        '200':
          description: A list of the latest trending cryptocurrencies.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrendingLatestResponse'
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-CMC_PRO_API_KEY
  schemas:
    LatestQuotesResponse:
      type: object
      properties:
        data:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/CryptocurrencyQuote'
    CryptocurrencyQuote:
      type: object
      properties:
        price:
          type: number
        volume_24h:
          type: number
        market_cap:
          type: number
        percent_change_24h:
          type: number
    HistoricalQuotesResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/HistoricalCryptocurrencyData'
    HistoricalCryptocurrencyData:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        symbol:
          type: string
        is_active:
          type: integer
        is_fiat:
          type: integer
        quotes:
          type: array
          items:
            $ref: '#/components/schemas/QuoteDetail'
    QuoteDetail:
      type: object
      properties:
        timestamp:
          type: string
          format: date
        quote:
          $ref: '#/components/schemas/QuoteCurrency'
    QuoteCurrency:
      type: object
      properties:
        USD:
          $ref: '#/components/schemas/CurrencyDetail'
    CurrencyDetail:
      type: object
      properties:
        price:
          type: number
        volume_24h:
          type: number
        market_cap:
          type: number
        circulating_supply:
          type: number
        total_supply:
          type: number
        timestamp:
          type: string
          format: date
    TrendingCryptocurrency:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        symbol:
          type: string
        slug:
          type: string
        cmc_rank:
          type: integer
        is_active:
          type: boolean
        is_fiat:
          type: integer
        num_market_pairs:
          type: integer
        circulating_supply:
          type: number
        total_supply:
          type: number
        max_supply:
          type: number
        tags:
          type: array
          items:
            type: string
        quote:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Quote'
    Quote:
      type: object
      properties:
        price:
          type: number
        volume_24h:
          type: number
        percent_change_1h:
          type: number
        percent_change_24h:
          type: number
        percent_change_7d:
          type: number
        market_cap:
          type: number
    TrendingLatestResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/TrendingCryptocurrency'
0xRichardH commented 3 months ago
roofeel commented 2 months ago

@iannono richard那边已经实现了,这个issue还需要处理什么