Skip to content

Commit

Permalink
Merge pull request #32 from coinmetrics/staging
Browse files Browse the repository at this point in the history
Update Master
  • Loading branch information
peterc-yuma authored Dec 20, 2024
2 parents b029848 + e129535 commit 390266e
Show file tree
Hide file tree
Showing 16 changed files with 1,047 additions and 826 deletions.
39 changes: 24 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
## Network Parameters ##
################################################################################
# User Parameters #
################################################################################
coldkey = default
validator_hotkey = validator
miner_hotkey = miner
netuid = $(testnet_netuid)
network = $(testnet)


################################################################################
# Network Parameters #
################################################################################
finney = wss://entrypoint-finney.opentensor.ai:443
testnet = wss://test.finney.opentensor.ai:443
locanet = ws://127.0.0.1:9944

testnet_netuid = 256
localnet_netuid = 1
logging_level = trace # options= ['info', 'debug', 'trace']
logging_level = info # options= ['info', 'debug', 'trace']

netuid = $(testnet_netuid)
network = $(testnet)

## User Parameters
coldkey = default
validator_hotkey = validator
miner_hotkey = miner
################################################################################
# Commands #
################################################################################

metagraph:
btcli subnet metagraph --netuid $(netuid) --subtensor.chain_endpoint $(network)
Expand All @@ -30,7 +39,7 @@ validator:
--wallet.name $(coldkey) \
--wallet.hotkey $(validator_hotkey) \
--subtensor.chain_endpoint $(network) \
--axon.port 30335 \
--axon.port 8091 \
--netuid $(netuid) \
--logging.level $(logging_level)

Expand All @@ -40,21 +49,21 @@ miner:
--wallet.name $(coldkey) \
--wallet.hotkey $(miner_hotkey) \
--subtensor.chain_endpoint $(network) \
--axon.port 30336 \
--axon.port 8092 \
--netuid $(netuid) \
--logging.level $(logging_level) \
--timeout 16 \
--vpermit_tao_limit 2 \
--forward_function forward
--forward_function base_miner

miner2:
custom_miner:
python start_miner.py \
--neuron.name miner2 \
--neuron.name custom_miner \
--wallet.name $(coldkey) \
--wallet.hotkey miner2 \
--subtensor.chain_endpoint $(network) \
--axon.port 30337 \
--axon.port 8093 \
--netuid $(netuid) \
--logging.level $(logging_level) \
--timeout 16 \
--forward_function forward_bad
--forward_function custom_function
104 changes: 50 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
<div align="center">
<img src="docs/images/precog-logo.svg" />

# **CoinMetrics Precog Subnet** <!-- omit in toc -->

| | |
| :-: | :-: |
| **Status** | <img src="https://img.shields.io/github/v/release/coinmetrics/precog?label=Release" height="25"/> <img src="https://img.shields.io/github/actions/workflow/status/coinmetrics/precog/ci.yml?label=Build" height="25"/> <br> <a href="https://github.com/pre-commit/pre-commit" target="_blank"> <img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&label=Pre-Commit" height="25"/> </a> <a href="https://github.com/psf/black" target="_blank"> <img src="https://img.shields.io/badge/code%20style-black-000000.svg?label=Code%20Style" height="25"/> </a> <br> <img src="https://img.shields.io/github/license/coinmetrics/precog?label=License" height="25"/> |
| **Activity** | <img src="https://img.shields.io/github/commit-activity/m/coinmetrics/precog?label=Commit%20Activity" height="25"/> <img src="https://img.shields.io/github/commits-since/coinmetrics/precog/latest/dev?label=Commits%20Since%20Latest%20Release" height="25"/> <br> <img src="https://img.shields.io/github/release-date/coinmetrics/precog?label=Latest%20Release%20Date" height="25"/> <img src="https://img.shields.io/github/last-commit/coinmetrics/precog/dev?label=Last%20Commit" height="25"/> <br> <img src="https://img.shields.io/github/contributors/coinmetrics/precog?label=Contributors" height="25"/> |
| **Compatibility** | <img src="https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fcoinmetrics%2Fprecog%2Frefs%2Fheads%2Fdev%2Fpyproject.toml&query=%24.tool.poetry.dependencies.python&logo=python&label=Python&logoColor=yellow" height="25"/> <img src="https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fcoinmetrics%2Fprecog%2Frefs%2Fheads%2Fdev%2Fpyproject.toml&query=%24.tool.poetry.dependencies.bittensor&prefix=v&label=Bittensor" height="25"/> <br> <img src="https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fcoinmetrics%2Fprecog%2Frefs%2Fheads%2Fdev%2Fpyproject.toml&query=%24.tool.poetry.dependencies.coinmetrics-api-client&prefix=v&label=coinmetrics-api-client" height="25"/> |
| **Compatibility** | <img src="https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fcoinmetrics%2Fprecog%2Frefs%2Fheads%2Fdev%2Fpyproject.toml&query=%24.tool.poetry.dependencies.python&logo=python&label=Python&logoColor=yellow" height="25"/> <img src="https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fcoinmetrics%2Fprecog%2Frefs%2Fheads%2Fdev%2Fpyproject.toml&query=%24.tool.poetry.dependencies.bittensor&prefix=v&label=Bittensor" height="25"/> <br> <img src="https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fcoinmetrics%2Fprecog%2Frefs%2Fheads%2Fdev%2Fpyproject.toml&query=%24.tool.poetry.dependencies.coinmetrics-api-client&label=coinmetrics-api-client" height="25"/> |
| **Social** | <a href="" target="_blank"> <img src="https://img.shields.io/website?url=https%3A%2F%2Fcharts.coinmetrics.io%2Fcrypto-data%2F&up_message=CoinMetrics&label=Website" height="25"/> </a> |


</div>

---

- [Introduction](#introduction)
- [Design Decisions](#design-decisions)
- [Installation](#installation)
- [Subnet Participation](#subnet-participation)
- [Makefile](#makefile)
- [Running a Miner](#running-a-miner)
- [Running a Validator](#running-a-validator)
- [About the Rewards Mechanism](#about-the-rewards-mechanism)
- [Roadmap](#roadmap)
- [Compute Requirements](#compute-requirements)
- [License](#license)

---
## Introduction

CoinMetrics Blurb
The Precog Subnet will serve as an arena to identify the analysts with the best strategies and information to anticipate Bitcoin price movements, and recruit them to share their insight with the broader community. By leveraging Bittensor’s subnet structure multiple perspectives can compete with the collective goal of filtering out noise in price signals. The open ecosystem creates a mechanism for people with unique knowledge to benefit themselves in exchange for sharing their specialties with the public

---
## Design Decisions
Another Blurb
The initial focus is on Bitcoin as it is the most well-established and arguably most decentralized crypto currency. Bitcoin has an abundance of high-resolution data, while still retaining enough volatility to make price prediction a valuable challenge.

We decided to focus on high-frequency predictions (every 5 minutes) with short resolution times (every hour) because we believe this leverages the unique capabilities of Bittensor to do something that traditional derivatives markets cannot do. While options and futures allow markets to express sentiments around asset price, they are unable to do so in a continuously and with such a short settlement time.

The incentive mechanism was specifically designed to reward precise statements of the future price level, as well as the most likely band the price will trade in. Compared to mechanisms with less precise “long” or “short” predictions, and pre-determined strike price intervals, we believe the metrics we query are closer to what traders and analysts truly want: the most likely price in the future with frequent updates.

---
## Compute Requirements

| Validator | Miner |
|---------- |-----------|
| 8gb RAM | 8gb RAM |
| 2 vCPUs | 2 vCPUs |

---
## Installation
Expand Down Expand Up @@ -70,28 +68,43 @@ poetry install
```

---
## Subnet Participation
heres how you do stuff
## Configuration

### Makefile
Start by editing the Makefile with you wallet and network information.
Start by editing the Makefile with you wallet and network information:
```
################################################################################
# User Parameters #
################################################################################
coldkey = default
validator_hotkey = validator
miner_hotkey = miner
netuid = $(testnet_netuid)
network = $(testnet)
```

### Wandb
Wandb integration is planned for mainnet launch and does not currently work.

---
## Deployment

### Running a Miner
TODO: write this \
Base miner:
1. Run the command:
```
make miner
```
Custom miner:
1. Write a custom forward function stored in precog/miners/your_function.py
1. Write a custom forward function stored in `precog/miners/your_file.py`
- `miner.py` searches for a function called `forward` contained within your provided file `--forward_function your_file`
- This function should handle how the miner responds to requests from the validator
- Within the function, synapse.predictions and synapse.interval should be set.
- See [forward.py](https://github.com/coinmetrics/precog/blob/master/precog/miners/forward.py) for an example
- Within the forward function, `synapse.predictions` and `synapse.interval` should be set.
- See [base_miner.py](https://github.com/coinmetrics/precog/blob/master/precog/miners/base_miner.py) for an example
2. Add a command to Makefile.
- copy the miner command and rename it (e.g. miner_custom) in Makefile
- replace the --forward_function argument with your_function
- replace the `--forward_function base_miner` with `--forward_function your_file`
3. Run the Command:
```
make miner_custom
Expand All @@ -104,37 +117,20 @@ make validator
```
## About the Rewards Mechanism
Optional but recommended.
## Incentive Mechanism
Incentive mechanism whitepaper coming soon.
Briefly, miners are rewarded based on two factors:
1. A point estimate for the price of BTC in USD one hour from prediction time
2. An interval estimate (the minimum and maximum price of BTC over the next hour based on a 1s frequency)
For more information, feel free to investigate [reward.py](https://github.com/coinmetrics/precog/blob/master/precog/validators/reward.py) or [base_miner.py](https://github.com/coinmetrics/precog/blob/master/precog/miners/base_miner.py)
---
## Roadmap
## Compute Requirements
Our goal is to continuously improve the subnet and tune it to the goals and interests that will engage the community. We have considered additions in the form of additional asset coverage, such as extending price analysis to TAO tokens. Extensions can also mean incentive mechanisms to calculate new types of metrics such as anticipating volatility, transaction volumes, or the cost of different types of transfers. Our greatest strength is our deep and professional data library, used by many of the largest financial institutions in crypto. We expect these resources will allow the subnet scope to adapt quickly when conditions are right.
TODO: update these
| Validator | Miner |
|---------- |-----------|
| 8gb RAM | 8gb RAM |
| 2 vCPUs | 2 vCPUs |
## License
This repository is licensed under the MIT License.
```text
# The MIT License (MIT)
# Copyright © 2024 CoinMetrics LLC
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the “Software”), to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of
# the Software.
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
# THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
```
We hope to, on one hand, leverage our existing products and coverage to make generating new insights as frictionless as possible for Miners. While on the other hand, we also hope to integrate new data streams into our catalog that only the Bittensor ecosystem can generate. Our aim is for these novel outputs to ultimately bring new participants to Bittensor from the broader crypto community, as we serve metrics and analysis that can't be obtained anywhere else.
7 changes: 7 additions & 0 deletions docs/Release Notes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Release Notes
=============

0.2.0
-----
Released on December 20th 2024
- Finalized README instructions
- Cleaned and documented code base


0.1.0
-----
Released on December 10th 2024
Expand Down
2 changes: 0 additions & 2 deletions docs/images/precog-logo.svg

This file was deleted.

Loading

0 comments on commit 390266e

Please sign in to comment.