Skip to content

Commit

Permalink
[cql] update cypher examples (#9)
Browse files Browse the repository at this point in the history
* add offline analytics queries

* scaffold matching

* try broad search expanding the ledger funding window

* add caching

* prevent duplicates in impossible

* try alternate calc

* patches

* wip

* update tests

* sample cql files

* cli cleanup

* save cache

* docs

* index

* refactor ordertyp

* shill refactor

* clippy

* patch persist shill

* patch tests

* patch batch tests

* names

* info prints

* patch cypher query

* cleanup cql

* [analytics] add example for offline analysis for exchange data (#6)

* add offline analytics queries

* scaffold matching

* try broad search expanding the ledger funding window

* add caching

* prevent duplicates in impossible

* docs

* fix

* clippy

---------

Co-authored-by: Montague McMarten <[email protected]>
Co-authored-by: Archibald LeCony <[email protected]>
Co-authored-by: Gabi O'Bittern <gabi_o'[email protected]>
Co-authored-by: Rosina Legato <[email protected]>
Co-authored-by: Sere di Stag <[email protected]>
Co-authored-by: Vale O'Piano <vale_o'[email protected]>
  • Loading branch information
7 people authored Jan 19, 2025
1 parent 52a54e9 commit d1fa113
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/cql/find_top_shill.cql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
MATCH ()-[r:Swap {`accepter_shill_up`: true }]->(accepter)
// WHERE date(r.filled_at) > date("2024-02-10")
// AND date(r.filled_at) < date("2024-03-02")
RETURN DISTINCT(accepter.`swap_id`) AS user , count(r) AS count, toFloat(sum(r.amount)) AS amount
ORDER BY amount DESC
2 changes: 1 addition & 1 deletion docs/cql/shill_trader_pairs.cql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
MATCH (a)-[r:Swap]-(b)
WITH a, b,
count(r) AS total_count,
sum(CASE WHEN r.shill_bid = true THEN 1 ELSE 0 END) AS shill_bid_count,
sum(CASE WHEN r.`accepter_shill_up` = true THEN 1 ELSE 0 END) AS shill_bid_count,
sum(CASE WHEN r.price_vs_rms_hour > 1 THEN 1 ELSE 0 END) AS price_vs_rms24h_count
WHERE total_count >= 5
ORDER BY total_count DESC
Expand Down
2 changes: 2 additions & 0 deletions src/warehouse_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ pub struct WarehouseCli {
#[clap(long, short('u'))]
/// username of db
db_username: Option<String>,

#[clap(long, short('p'))]
/// db password
db_password: Option<String>,

#[clap(long, short('q'))]
/// force clear queue
clear_queue: bool,
Expand Down

0 comments on commit d1fa113

Please sign in to comment.