Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timespandandiv #166

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
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
58 changes: 29 additions & 29 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ name: "CodeQL"

on:
push:
branches: [ main ]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: [main]
schedule:
- cron: '38 13 * * 3'
- cron: "38 13 * * 3"

jobs:
analyze:
Expand All @@ -32,39 +32,39 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'go', 'javascript' ]
language: ["go", "javascript"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
9 changes: 3 additions & 6 deletions cmd/cli/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ import (
"github.com/teal-finance/garcon"
"github.com/teal-finance/garcon/gg"
"github.com/teal-finance/rainbow/pkg/provider"
)

const (
defaultProviders = "ALL" //"deribit,delta,lyra,synquote,aevo,rysk,sdx"
"github.com/teal-finance/rainbow/pkg/rainbow/x"
)

var (
Expand All @@ -23,7 +20,7 @@ var (
exotic = flag.Bool("exotic", false, "Enable the decentralized exchanges with binary options: Thales")
infos = flag.Bool("infos", false, "Show additional infos on instruments like URL ...")

providers = flag.String("providers", gg.EnvStr("PROVIDERS", defaultProviders), "Coma-separated list of providers, same as the PROVIDERS env. var.")
providers = flag.String("providers", gg.EnvStr("PROVIDERS", x.DefaultProviders), "Coma-separated list of providers, same as the PROVIDERS env. var.")
)

func parseFlags() {
Expand All @@ -43,7 +40,7 @@ func parseFlags() {
// listProviderNames is duplicated https://github.com/teal-finance/rainbow/blob/main/cmd/server/flags.go#L88
func listProviderNames() []string {
if *cex || *dex || *exotic {
if *providers == defaultProviders {
if *providers == x.DefaultProviders {
*providers = ""
}
if *cex {
Expand Down
11 changes: 8 additions & 3 deletions cmd/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package main

import (
"fmt"
"math"
"os"

Expand All @@ -17,20 +18,23 @@ import (
"github.com/teal-finance/rainbow/pkg/rainbow"
"github.com/teal-finance/rainbow/pkg/rainbow/api"
"github.com/teal-finance/rainbow/pkg/rainbow/storage/dbram"
"github.com/teal-finance/rainbow/pkg/rainbow/x"
)

var (
log = emo.NewZone("main")
green = color.FgGreen.Render
gray = color.FgGray.Render
red = color.FgRed.Render
magenta = color.FgMagenta.Render
blue = color.FgCyan.Render
darkBlue = color.FgBlue.Render
)

func main() {
//_ = x.Note
parseFlags()

fmt.Println(*x.Note)
names := listProviderNames()
log.Init("Providers:", names)

Expand All @@ -57,7 +61,7 @@ func printTable(options []rainbow.Option) {

t.AppendHeader(table.Row{
"Provider", "Asset", "Type", "Size", green(" Bid"), "Strike", blue("MarketIV"),
red(" Ask"), "Size", darkBlue("Open Interest"), "Instrument",
red(" Ask"), "Size", darkBlue("Open Interest"), "Instrument", "Expiry",
})

align := api.NewAlign()
Expand All @@ -68,7 +72,8 @@ func printTable(options []rainbow.Option) {
highlight(o.Provider), o.Asset, o.Type,
bestBidQty, green(bestBidPx), math.Round(o.Strike*100) / 100,
blue(math.Round(o.MarketIV*100) / 100),
red(bestAskPx), bestAskQty, darkBlue(math.Round(o.OpenInterest*100) / 100), o.Name,
red(bestAskPx), bestAskQty, darkBlue(math.Round(o.OpenInterest*100) / 100),
o.Name, gray(o.ExpiryTime),
}})
}

Expand Down
13 changes: 6 additions & 7 deletions cmd/server/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ import (
"github.com/teal-finance/garcon/gg"
"github.com/teal-finance/garcon/timex"
"github.com/teal-finance/rainbow/pkg/provider"
"github.com/teal-finance/rainbow/pkg/rainbow/x"
)

const (
defaultAddr = "http://localhost"
defaultPort = 8090
defaultProviders = "ALL"
)

Expand All @@ -28,9 +27,9 @@ var (
cex = flag.Bool("cex", false, "Enable the centralized exchanges: Deribit, Delta Exchange and Thalex")
dex = flag.Bool("dex", false, "Enable the decentralized exchanges: Lyra, Synquote, Aevo, Rysk and SDX")
exotic = flag.Bool("exotic", false, "Enable the decentralized exchanges with binary options: Thales")
providers = flag.String("providers", gg.EnvStr("PROVIDERS", defaultProviders), "Coma-separated list of providers, has precedence over PROVIDERS")
mainAddr = flag.String("addr", gg.EnvStr("MAIN_ADDR", defaultAddr), "Schema and DNS used for doc URL and CORS, has precedence over MAIN_ADDR")
mainPort = flag.Int("port", gg.EnvInt("MAIN_PORT", defaultPort), "API port, has precedence over MAIN_PORT")
providers = flag.String("providers", gg.EnvStr("PROVIDERS", x.DefaultProviders), "Coma-separated list of providers, has precedence over PROVIDERS")
mainAddr = flag.String("addr", gg.EnvStr("MAIN_ADDR", x.DefaultAddr), "Schema and DNS used for doc URL and CORS, has precedence over MAIN_ADDR")
mainPort = flag.Int("port", gg.EnvInt("MAIN_PORT", x.DefaultPort), "API port, has precedence over MAIN_PORT")
expPort = flag.Int("exp", gg.EnvInt("EXP_PORT"), "Export port for Prometheus, has precedence over EXP_PORT")
reqPerMinute = flag.Int("rate", gg.EnvInt("REQ_PER_MINUTE", 88), "Max requests per minute, has precedence over REQ_PER_MINUTE")
reqBurst = flag.Int("burst", gg.EnvInt("REQ_BURST", 22), "Max requests during a burst, has precedence over REQ_BURST")
Expand All @@ -48,7 +47,7 @@ func parseFlags() {

listenAddr = ":" + strconv.Itoa(*mainPort)

if !*dev && *mainAddr == defaultAddr && *mainPort == defaultPort {
if !*dev && *mainAddr == x.DefaultAddr && *mainPort == x.DefaultPort {
*dev = true
log.Init("Enable -dev mode because -addr and -port flags are not used")
}
Expand Down Expand Up @@ -90,7 +89,7 @@ func parseFlags() {
// listProviderNames is duplicated https://github.com/teal-finance/rainbow/blob/main/cmd/cli/flags.go#L42
func listProviderNames() []string {
if *cex || *dex || *exotic {
if *providers == defaultProviders {
if *providers == x.DefaultProviders {
*providers = ""
}
if *cex {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/api/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// SPDX-License-Identifier: MIT

const classicOptionsQuery = `{
rows(providers: ["Delta Exchange", "Deribit", "Thalex", "Aevo", "Lyrav2", "Lyra::Arbitrum", "Lyra::Optimism", "Synquote", "Rysk", "SDX"]) {
rows(providers: ["Delta Exchange", "Deribit", "Thalex", "Aevo", "Lyra", "Synquote", "Rysk", "SDX"]) {
date
expiry
provider
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/const/filter_presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ const filterPresets: Record<string, any> = {
'DEXes': {
assets: { 'defaultValue': true },
providers: {
'defaultValue': false, 'Aevo': true,
'Lyrav2': true, 'Lyra::Optimism': true, 'Lyra::Arbitrum': true,
'defaultValue': false, 'Aevo': true, 'Lyra': true,
'Thales::Polygon': true, 'Thales::Arbitrum': true, 'Thales::Optimism': true,
'Thales::Bsc': true, 'Synquote': true, 'SDX': true
}
Expand Down
70 changes: 23 additions & 47 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
module github.com/teal-finance/rainbow

go 1.22
go 1.22.1

require (
github.com/Khan/genqlient v0.7.0
github.com/davecgh/go-spew v1.1.1
github.com/ethereum/go-ethereum v1.13.14
github.com/friendsofgo/graphiql v0.2.2
github.com/gagliardetto/binary v0.7.9
github.com/gagliardetto/gofuzz v1.2.2
github.com/gagliardetto/solana-go v1.8.4
github.com/gagliardetto/treeout v0.1.4
github.com/go-chi/chi/v5 v5.0.12
github.com/google/go-cmp v0.6.0
github.com/gookit/color v1.5.4
github.com/graphql-go/graphql v0.8.1
github.com/graphql-go/handler v0.2.3
github.com/jedib0t/go-pretty/v6 v6.5.4
github.com/jedib0t/go-pretty/v6 v6.5.6
github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de
github.com/spewerspew/spew v0.0.0-20230513223542-89b69fbbe2bd
github.com/stretchr/testify v1.9.0
Expand All @@ -25,88 +20,69 @@ require (
)

require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/JohannesKaufmann/html-to-markdown v1.5.0 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/PuerkitoBio/goquery v1.9.1 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/acmacalister/skittles v0.0.0-20160609003031-7423546701e1 // indirect
github.com/agnivade/levenshtein v1.1.1 // indirect
github.com/alexflint/go-arg v1.4.3 // indirect
github.com/alexflint/go-scalar v1.2.0 // indirect
github.com/alexflint/go-arg v1.4.2 // indirect
github.com/alexflint/go-scalar v1.0.0 // indirect
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/andybalholm/cascadia v1.3.2 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.13.0 // indirect
github.com/blendle/zapdriver v1.3.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/carlmjohnson/flagx v0.22.2 // indirect
github.com/carlmjohnson/versioninfo v0.22.5 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect
github.com/cristalhq/base64 v0.1.2 // indirect
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/ethereum/c-kzg-4844 v0.4.3 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
github.com/felixge/fgprof v0.9.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.7 // indirect
github.com/logrusorgru/aurora v2.0.3+incompatible // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/minio/highwayhash v1.0.2 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mostynb/zstdpool-freelist v0.0.0-20201229113212-927304c0c3b1 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/mtraver/base91 v1.0.0 // indirect
github.com/pkg/profile v1.7.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.19.0 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
github.com/prometheus/common v0.50.0 // indirect
github.com/prometheus/procfs v0.13.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rs/cors v1.10.1 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/streamingfast/logging v0.0.0-20230608130331-f22c91403091 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/teal-finance/incorruptible v0.0.0-20240312165854-121ce0ea4494 // indirect
github.com/teal-finance/quid v0.0.0-20240312173051-86f439faafcf // indirect
github.com/tklauser/go-sysconf v0.3.13 // indirect
github.com/tklauser/numcpus v0.7.0 // indirect
github.com/teal-finance/incorruptible v0.0.0-20240312103045-cd27cac96f11 // indirect
github.com/teal-finance/quid v0.0.0-20230216061629-9c9b3ff5e887 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/vektah/gqlparser/v2 v2.5.11 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.mongodb.org/mongo-driver v1.14.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/ratelimit v0.3.1 // indirect
go.uber.org/zap v1.27.0 // indirect
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.19.0 // indirect
golang.org/x/tools v0.18.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading
Loading