Showing posts with label neo4j Aura. Show all posts
Showing posts with label neo4j Aura. Show all posts

Sunday, May 19, 2024

Cryptocurrency pop-quiz answer: "What's my $ETH position?" as a Voronoi chart

For the #cryptocurrency pop-quiz on "What's my $ETH position?" I went with option 3, creating a cypher query against my @neo4j Blockaverse portfolio ontology.

This approach allows me to map out my positions and their relative strengths in, say, a Voronoi chart. 




Wednesday, May 8, 2024

neo4j ontology of Terra portfolio

Query: Is $KUJI in my @terra_money portfolio?



Response: my portfolio-as-ontology on @neo4j-query

match (t:Token)-->{2}(:Blockchain {name: "Terra"})
return distinct t.name


says 'No.'

Adjusting my tracked-tokens list on that portfolio accordingly.


Wednesday, April 10, 2024

Rust pop-quiz answer: portfolio-as-ontology in neo4j

#Rust pop-quiz answer to the quiz of: portfolio-as-ontology.

Behold! ./ont.



Also, I have a video walkthrough of creating, viewing, and querying the ontology in @neo4j. 

Wednesday, September 13, 2023

2023-09-13 ETHBTC-THANG! Day 108

Let's do the ETHBTC-THANG!

I record the $ETH and $BTC prices from @osmosiszone, where errors are resurfacing for the $wBTC price.



I record these prices into my SPREADSHEETSZORXEN! 

SPREADSHEETSZORXEN! says 'swap 0.00812 $BTC' (I'll come to that eventually), so I withdraw that amount from @TeamKujira Ghost lend.



But where to swap?

Aye: there's the rub.

Let's look at 4 (non-)options, then a fifth OG geophf-option.

For DEXen, worst (least $ETH from $BTC) to best (most). 

For 0.00812 $BTC I get _ from: _

  1. 0.1299 $ETH: @THORSwap (ignoring gas fees)


  1. 0.1309 $ETH: @Manta_DAO


  1. 0.1315 $ETH: @osmosiszone


  1. 0.1317 $ETH: @NolusProtocol (lease then payoff)



Folks: learn leasing.

"...butbutbut HOWDOILEARNLEASING, o, el geophf?"


All on my blog, folks, with other juicy α. All free. For you. 

"So, el geophf, ya gonna lease-then-payoff, then, for the BTC-ETH 'swap'?"

Maybe. The above four give you the (kinda-)DEX-approach.

Let's take a deeper dive.

These are the viable paths for the @TeamKujira order books, diagrammed by ./graphista.



These data are graphed in @neo4j cloud db Aura, uploaded with queries.cyp:

https://github.com/logicalgraphs/crypto-n-rust/blob/main/src/ch08/graphista/queries.cyp

Okay, fine. What are the directed and acyclic paths from $wBTC to $wETH?

Easy. That's the Cypher query:

match p=(c {name: "wBTC"})-[*1..4]->(c1{name: "wETH"}) 
return p



This, however, is inhuman AND inhumane in the amount of pathing one must do to trade from $wBTC to $wETH on @TeamKujira FIN.

That's why I have ./vern, my main man, ./vern.



There's a problem, however, when I output the viable paths as CSV.

Dear @neo4j,

Seriously? Again?




You've had this problem FOR YEARS!
I have pointed this problem out on MULTIPLE occasions!

Please fix CSV output to be NO QUOTES, not 300,000 quotes.

ffs 🙄

love, geophf

Dear @neo4j,

A reference how CSV output, that is: sane CSV output, SHOULD look like and how your CSV output USED TO look like.




You pay bounties for people who find bugs in your system?

wallet addy: kujira1h525rx052gx2qt9qc9jqj6f7thv5h3lylja47q

So, I'm a programmer.

Let's pretend problems don't distract me from just writing the d-mn solution.

They do, but let's pretend.

Behold. 



all-isomorphic-paths.csv (up to 3-deep) on @TeamKujira FIN, ... NOW INCLUDING $MNTA ORDER BOOKS!! 💥💥💥 

That, along with the latest market data and my (non-)list of synthetic order books allows me to run ./vern, my main man, ./vern!

What does ./vern say?


Huh! If that isn't disappointing!

But am I disappointed? No.

Sometimes, ./vern fails me, be it the verra smol amount traded or inactive-order-book hell.

This does not stop me. No weapon formed against me shall stop me.

I'll just find another way! Let's look at the order books




The key here is to look at the HIGHEST price to SELL $wBTC and the LOWEST price to BUY $wETH.

SELL HIGH; BUY LOW

Then create a path between those two, which entail mixing in:

USK,axlUSDC,ATOM,KUJI,MNTA,






not in any particular order. 

So, the trick is to stitch the order books together in a pretty-durn-good transactional chain.

How do you know that your path is a winner?

Enter: ./emily 

I run my three best guesses through ./emily, and ./emily tells me what the result of the trade is.



Now, ./emily runs the trade AT MARKET PRICE, ONLY! But that's what @Manta_DAO is supposed to do, automatically.

So why does ./emily easily beat @Manta_DAO? 🤔



@NolusProtocol lease-then-payoff just beats my best trade, without the hassle of going through five order books.



But, even still: it's not as easy as all that.

@NolusProtocol beats market price trades.

I NEVER trade at market price. Why would I?

So, with ./emily I can get the trade to be around 0.1355, just above or below market price, on order books with $1k+ 24-hour volumes.

So, I place the first order in the 

> $wBTC > $USK > $axlUSDC > $ATOM > $KUJI > $wETH

trade-path, and call it a night.



G'night, fam. I have a video-conference at midnight, then a meeting at 1:15 am ET. 😴

Pivoted: $wBTC > $MNTA > $KUJI > $wETH

I'm at the $KUJI > $wETH part of the trade. I took a wee bit o' profit in $KUJI, and still I beat all DEX trades.






Next time I need to long the objective ($wETH) during these trades so the objective doesn't escape me on a moonshot.

Tuesday, April 11, 2023

Kujira FIN order books as a neo4j-graph

New graph of @TeamKujira FIN order books on @neo4j Aura graph database.


Graph generated from ./graphista and loaded with a set of Cypher queries

Saturday, February 25, 2023

"Synthetic" order books

The @TeamKujira FIN order books have a problem. There are too many order books with hardly any volume. How do solve this problem?

I am introducing the concept of 'synthetic order books.' 


Synthetic order books: aren't.

They are usually LPs on, e.g.: Osmosis, Comdex, or Terra.

To this end, I am modifying ./vern, my main man, ./vern in two significant ways.

  1. ./vern will now use synthetic order books as well.
  2. ./vern will now consider the order books' volume to compute the best arbitration paths.

The aim: to make more arb-paths successful trades.

Infrastructure:

  1. ./vern now incorporates ./top_order_books to compute order book volumes to minimize trade-risk. 
  2. The synthetic order books are here. You see mostly @osmosiszone and @ComdexOfficial swap-pairs. 



Friday, October 7, 2022

Solution to the Stable routing bonus quiz

Partial solution to the Stable routing bonus quiz:

I've mapped stable-to-stable across DEXen. Here're those mappings: 


You see from the raw data (below), there are 66 edges to this graph. SOME of which have a gain-multiplier (marked in green)! 

Partial solution, part II:





  • Sample Stable Coin graph


  • Dijkstra shortest path $DAI.e -> $USDT.e


But there's a problem...

The problem here is Dijkstra solves for SHORTEST path, but the LOWER the multiplier, the MORE disadvantageous the trade.

I must rework my data set that has an inverted multiplier, but some multipliers, as you saw, are ABOVE 1.0, i.e.: an ADVANTAGEOUS swap.

Some thought required.

Okay, redesigned with an efficacy-score. DONE! ✅ 



NOT DONE! 😤

The problem with pathing algorithms for this particular domain is that the multipliers are not path-lengths, but, as their name denotes: multipliers.

I think I may have to tune an algorithm then patten(tm)(r)(c) it.

BUT IN THE INTERIM! 

I CAN query the graph and ask:

"Are there paths that pay ME to swap?" or, in cypher:

match p =(c)-[r]->(c1)
where r.efficacy < 1 
return p
And there are:


How about we go one step further?

"Is there a multiple hope currency-swap that is efficacious?" or, in cypher:

match p =(c)-[r]->(c1)-[r1]->()
where r.efficacy < 1 and r1.efficacy < 1
return p


Answer: NUPE! 

Oh, well.