Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
447 changes: 294 additions & 153 deletions Pipfile.lock

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ For full API documentation and metric definitions, see [Santiment Academy](https

- [Installation](#installation)
- [Extra packages](#extra-packages)
- [CLI](#cli)
- [Configuration](#configuration)
- [Environment variable](#environment-variable)
- [Programmatic](#programmatic)
Expand Down Expand Up @@ -61,6 +62,54 @@ There are a few utilities in the `san/extras/` directory for backtesting and eve
pip install 'sanpy[extras]'
```

## CLI

Sanpy includes a command-line interface for quick data access without writing Python.

```
san --help
san --version
```
Comment on lines +69 to +72
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add a language to this fenced block.

This trips markdownlint and loses shell highlighting.

Proposed fix
-```
+```bash
 san --help
 san --version
</details>

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.22.0)</summary>

[warning] 69-69: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @README.md around lines 69 - 72, The fenced code block containing the
commands "san --help" and "san --version" lacks a language tag, which trips
markdownlint and prevents shell highlighting; update that block by changing the
opening backticks to include a language identifier (e.g., replace withbash) so the block reads bash followed by the two commands and closing
to enable shell syntax highlighting.


</details>

<!-- fingerprinting:phantom:medusa:grasshopper -->

<!-- This is an auto-generated comment by CodeRabbit -->


### Configuration

```bash
san config set-key <your-api-key> # Store API key
san config show # Show current config
san config path # Config file location
san config clear # Remove stored API key
```

The CLI reads the API key from (in order): `--api-key` flag, `SANPY_APIKEY` env var, stored config file.

### Discovery

```bash
san metrics # List all metrics
san metrics --slug bitcoin # Metrics for a specific asset
san projects # List all projects
```

### Fetching data

```bash
san get price_usd --slug bitcoin --from 2024-01-01 --to 2024-01-05
san get price_usd --slug bitcoin --from 2024-01-01 --to 2024-01-05 -f json
san get price_usd --slug bitcoin --aggregation avg

san get-many price_usd --slugs bitcoin,ethereum --from 2024-01-01 --to 2024-01-05
```

### Rate limits & complexity

```bash
san rate-limit # API calls remaining
san api-calls # API call history
san complexity price_usd # Query complexity check
```

All commands support `--format` (`table`, `json`, `csv`) and `--api-key` options.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Scope the flag-support claim more narrowly.

san/cli.py only adds --format/--api-key to the discovery/data/diagnostic commands. config subcommands don't accept those flags, so this sentence currently overstates the interface.

Proposed wording
-All commands support `--format` (`table`, `json`, `csv`) and `--api-key` options.
+The discovery, data, and diagnostics commands support `--format` (`table`, `json`, `csv`).
+API-backed commands also accept `--api-key`.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
All commands support `--format` (`table`, `json`, `csv`) and `--api-key` options.
The discovery, data, and diagnostics commands support `--format` (`table`, `json`, `csv`).
API-backed commands also accept `--api-key`.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` at line 111, The README currently claims "All commands support
`--format` (`table`, `json`, `csv`) and `--api-key` options" which is
inaccurate; update that sentence to scope the flag support to only the commands
that `san/cli.py` actually registers: the discovery, data, and diagnostic
subcommands. Replace the line with wording that explicitly states that
`--format` and `--api-key` are supported by the discovery, data, and diagnostic
commands (and not by config subcommands), referencing `san/cli.py` and the
discovery/data/diagnostic command names to make the scope clear.


## Configuration

Some metrics require a paid [SanAPI plan](https://academy.santiment.net/products-and-plans/sanapi-plans/) to access real-time or full historical data. You can provide an API key in two ways:
Expand Down
3 changes: 1 addition & 2 deletions examples/extras/event_study.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"metadata": {},
"outputs": [],
"source": [
"from datetime import date\n",
"import numpy as np\n",
"import san\n",
"\n",
Expand Down Expand Up @@ -289,7 +288,7 @@
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>61 rows × 6 columns</p>\n",
"<p>61 rows \u00d7 6 columns</p>\n",
"</div>"
],
"text/plain": [
Expand Down
Loading