# Wallet PNL chart

## GET /wallets/{address}/charts/pnl

> Returns wallet PNL chart data.\
> Require period or custom time to be set. \
> To set custom time interval use \`from\_time\` and \`to\_time\` params.<br>

```json
{"openapi":"3.1.0","info":{"title":"Analytics API","version":"1.0.4"},"tags":[{"name":"wallet","description":"Wallet"}],"servers":[{"url":"https://definest.ai/api/analytics/v1","description":"Production server"}],"security":[{"xApiKey":[]}],"components":{"securitySchemes":{"xApiKey":{"type":"apiKey","in":"header","name":"X-API-Key","description":"API key for authentication"}},"parameters":{"WalletAddressPathParam":{"name":"address","in":"path","description":"Wallet address","required":true,"schema":{"$ref":"#/components/schemas/Wallet/properties/address"}},"BlockchainNetworkQueryParam":{"name":"network","in":"query","description":"Blockchain network","required":true,"schema":{"$ref":"#/components/schemas/BlockchainNetwork"}},"PeriodQueryParam":{"name":"period","in":"query","description":"Time period","schema":{"$ref":"#/components/schemas/Period"}},"FromTimeQueryParam":{"name":"from_time","in":"query","description":"Timestamp in seconds. \nMinimum time for the deal's first trade.\nDeals started before this time will be excluded from result and calculations.\n","schema":{"type":["integer","number"],"minimum":1}},"ToTimeQueryParam":{"name":"to_time","in":"query","description":"Timestamp in seconds. \nMaximum time for deal trades. \nTrades executed after this time will be excluded from result and calculations.\n","schema":{"type":["integer","number"],"minimum":1}}},"schemas":{"Wallet":{"properties":{"address":{"type":"string","description":"Wallet address"}}},"BlockchainNetwork":{"type":"string","enum":["eth","sol"],"description":"Supported blockchain networks"},"Period":{"type":"string","description":"Time period","enum":["12h","24h","2d","3d","7d","10d","14d","20d","1m","2m","3m","6m","1y","2y"]},"PnlChart":{"type":"object","description":"PNL chart data","properties":{"timestamps":{"$ref":"#/components/schemas/ChartTimestampsArray"},"initial_values":{"type":"array","description":"Array of initial PNL values corresponding to each timestamp. In USD ($)","items":{"$ref":"#/components/schemas/PnlValue"}},"following_values":{"type":"array","description":"Array of following PNL values corresponding to each timestamp. In USD ($)","items":{"$ref":"#/components/schemas/PnlValue"}},"period":{"$ref":"#/components/schemas/ChartPeriod"}},"required":["timestamps","initial_values","following_values","period"]},"ChartTimestampsArray":{"type":"array","description":"Array of timestamps for each data point","items":{"type":["integer"],"description":"UNIX timestamp in seconds"}},"PnlValue":{"type":["number"],"description":"PNL value in USD ($)"},"ChartPeriod":{"type":"object","properties":{"start":{"type":["integer"],"description":"Start timestamp of the chart period in seconds"},"end":{"type":["integer"],"description":"End timestamp of the chart period in seconds"}},"required":["start","end"]},"ResponseCredits":{"type":"object","description":"Credits data after request","properties":{"spent":{"type":"integer","description":"Credits spent on the request"},"remaining":{"type":"integer","description":"Remaining credits"}},"required":["spent","remaining"]}},"responses":{"400BadRequest":{"description":"Request fail","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","description":"Error short code"},"detail":{"description":"Detailed error description"}},"required":["code"]}}}},"401Unauthorized":{"description":"API Key invalid or missing"},"403Forbidden":{"description":"API access forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","description":"Error short code"},"detail":{"description":"Detailed error description"}},"required":["code"]}}}}}},"paths":{"/wallets/{address}/charts/pnl":{"get":{"description":"Returns wallet PNL chart data.\nRequire period or custom time to be set. \nTo set custom time interval use `from_time` and `to_time` params.\n","tags":["wallet"],"parameters":[{"$ref":"#/components/parameters/WalletAddressPathParam"},{"$ref":"#/components/parameters/BlockchainNetworkQueryParam"},{"name":"type","in":"query","description":"PNL type. Only `realized` is available","schema":{"type":["string"],"enum":["realized"],"default":"realized"}},{"$ref":"#/components/parameters/PeriodQueryParam"},{"$ref":"#/components/parameters/FromTimeQueryParam"},{"$ref":"#/components/parameters/ToTimeQueryParam"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"result":{"type":"object","properties":{"chart":{"$ref":"#/components/schemas/PnlChart"}},"required":["chart"]},"credits":{"$ref":"#/components/schemas/ResponseCredits"}},"required":["result","credits"]}}}},"400":{"$ref":"#/components/responses/400BadRequest"},"401":{"$ref":"#/components/responses/401Unauthorized"},"403":{"$ref":"#/components/responses/403Forbidden"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.definest.ai/api/wallet-analytics/wallet-pnl-chart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
