---
title: 'Get Month Data'
api: 'GET /api/month/{month}'
description: 'Retrieves detailed trading data for a specific month'
---

## Endpoint

```
GET /api/month/{month}
```

## Path Parameters

<ParamField path="month" type="string" required>
  Month in YYYY-MM format (e.g., "2024-08")
</ParamField>

## Authentication

Requires OAuth 2.0 authentication via session cookies.

## Response

Returns detailed trading data including summary, trades, and dividends.

<ResponseField name="success" type="boolean" required>
  Request success status
</ResponseField>

<ResponseField name="summary" type="object" required>
  Monthly summary statistics
  
  <Expandable title="Summary Fields">
    <ResponseField name="month" type="string">
      Month in YYYY-MM format
    </ResponseField>
    <ResponseField name="total_trades" type="number">
      Total number of completed trades
    </ResponseField>
    <ResponseField name="winning_trades" type="number">
      Number of profitable trades
    </ResponseField>
    <ResponseField name="win_rate" type="number">
      Win rate percentage
    </ResponseField>
    <ResponseField name="trading_profit_loss" type="number">
      Total profit/loss from trades
    </ResponseField>
    <ResponseField name="total_dividends" type="number">
      Total dividend income
    </ResponseField>
    <ResponseField name="total_return_with_dividends" type="number">
      Combined trading P&L and dividends
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="trades" type="array" required>
  List of completed trades
</ResponseField>

<ResponseField name="dividends" type="array" required>
  List of dividend payments
</ResponseField>

## Example

<CodeGroup>
```bash cURL
curl -X GET https://your-domain.com/api/month/2024-08 \
  -H "Cookie: session=your_session_cookie"
```

```javascript JavaScript
const month = '2024-08';
const response = await fetch(`/api/month/${month}`);
const data = await response.json();

if (data.success) {
  console.log(`P/L: $${data.summary.trading_profit_loss}`);
  console.log(`Trades: ${data.trades.length}`);
}
```
</CodeGroup>

## Response Example

```json
{
  "success": true,
  "summary": {
    "month": "2024-08",
    "total_trades": 15,
    "winning_trades": 9,
    "win_rate": 60.0,
    "trading_profit_loss": 850.75,
    "total_dividends": 125.50,
    "total_return_with_dividends": 976.25
  },
  "trades": [
    {
      "symbol": "AAPL",
      "buy_date": "2024-08-01",
      "sell_date": "2024-08-15",
      "buy_price": 195.50,
      "sell_price": 198.75,
      "volume": 100,
      "total_profit_loss": 325.00,
      "return_percentage": 1.66,
      "trade_result": "Win"
    }
  ],
  "dividends": [
    {
      "transaction_date": "2024-08-15",
      "symbol": "MSFT",
      "action": "Cash Dividend",
      "amount": 75.50
    }
  ],
  "data_source": "postgresql"
}
```
