semvec/pypi-packages huggingface dataset:
marketdata-py 0.0.6
A Python client for the marketdata.app API
Requires Python: >=3.7

# MarketData API Client

This Python module provides a client for interacting with the [marketdata.app](https://marketdata.app) API. It offers both synchronous and asynchronous methods to fetch various financial data, including stock candles, options chains, and options quotes.

## Features

- Synchronous and asynchronous API clients
- Caching mechanism for efficient data retrieval
- Parallel processing for bulk data requests
- Support for various API endpoints:
  - Stock candles
  - Options chains
  - Options quotes
  - Index candles and quotes
  - Market status
  - Earnings data
  - Stock news

## Configuration

Create a file named `marketdata_api.key` in the `credentials` directory and add your MarketData API key to it.

## Usage

### Basic Usage

```python
from marketdata.manager import MarketDataManager
from datetime import date

mdm = MarketDataManager()

# Fetch stock candles
candles = mdm.get_stock_candles(["AAPL", "GOOGL"], "1D", from_date=date(2023, 1, 1), to_date=date(2023, 6, 1))

# Print the results
for symbol, df in candles.items():
    print(f"Candles for {symbol}:")
    print(df.head())
    print("\n")
```

### Fetching Options Data

```python
from marketdata.client_params import OptionsChainParams, OptionsQuoteParams

# Fetch options chains
chain_params = [
    OptionsChainParams(underlying="AAPL"),
    OptionsChainParams(underlying="GOOGL")
]
chains = mdm.get_options_chains(chain_params)

# Fetch options quotes
quote_params = [
    OptionsQuoteParams(option_symbol="AAPL230616C00150000"),
    OptionsQuoteParams(option_symbol="GOOGL230616P02000000")
]
quotes = mdm.get_options_quotes(quote_params)
```

### Using BasicParams and FromToParams

The `BasicParams` and `FromToParams` classes are used to provide common parameters for API requests:

```python
from marketdata.client_params import BasicParams, FromToParams
from datetime import date

# Basic parameters
basic_params = BasicParams(
    lookup_date=date(2023, 6, 1),
    dateformat="timestamp",
    limit=1000
)

# Date range parameters
from_to_params = FromToParams(
    from_date=date(2023, 1, 1),
    to_date=date(2023, 6, 1)
)

# Use these params in API calls
candles = mdm.get_stock_candles(
    ["AAPL"],
    "1D",
    basic_params=basic_params,
    from_to_params=from_to_params
)
```

`BasicParams` includes common options like date format and result limits, while `FromToParams` specifies date ranges for historical data queries.
squeel 1.1.0
Format embedded sql (squeel) in python source code files
Requires Python: <4.0,>=3.9

# Squeel

Format embedded sql (squeel) in python source code files.

Uses [treesitter](https://github.com/tree-sitter/tree-sitter) to query python strings inside the python files starting with a sql comment `-- sql`. Then formats the sql matching strings with the selected formatter, by default `pg_format`, and writes them back to the files.

Uses one of [sqlparse](https://github.com/andialbrecht/sqlparse) or [pg_format](https://github.com/darold/pgFormatter) to format the SQL within the python code.

## Warning

This is an experimental tool.

Its purpose is to change files on your system. I recommend checking your changes into git before running this tool in case it explodes. Ensure you give it the appropriate root_folder and glob patterns so it doesn't change files on your system that you don't want changed. No changes will be written to any files unless you supply the `--change` flag. The default behaviou is to dry run.

```
$ squeel .      
-- DRY RUN -- No actual changes will be made.
Found 42 files matching the glob pattern.
Would format 1 files:
test/data/test-1.py: 1 sql strings to be changed, 0 unchanged.
```

## Requirements

`pgFormatter` if using the default format strategy `pg_format`

## Install

`pip install squeel`

## Usage

See `squeel -h`

```
squeel -h
usage: squeel [-h] [--change] [--glob GLOB] [--format_strategy FORMAT_STRATEGY] root_folder

Squeel

positional arguments:
  root_folder           The root folder to look for files to format

options:
  -h, --help            show this help message and exit
  --change              Dry run
  --glob GLOB           Glob pattern
  --format_strategy FORMAT_STRATEGY
                        Format strategy, one of 'pg_format' or 'sqlparse' (default pg_format)
```

Example run:

```
squeel --glob *.py --format_strategy sqlparse --change src
```