Showing posts with label data visualization. Show all posts
Showing posts with label data visualization. Show all posts

Wednesday, April 10, 2024

Rust pop-quiz: ontology of integrated cryptocurrency portfolio

#Rust pop-quiz: #cryptocurrency 

Say you have your portfolio data of tokens, blockchains, protocols, say, in the following format.



Read in those data and associate tokens to protocols to blockchains, the output expressed to an ontology of your choice.

Tuesday, April 9, 2024

Cryptocurrency pop-quiz answer: ontology of my portfolio

Here's my first stab at the solution to building my portfolio as an ontology. I think this work will be ongoing, like: for example, I should associate tokens to protocols instead of blockchains, but here we go:

My portfolio as:

  • tokens in blockchains


  • protocols in blockchains


represented in @neo4j.

The final stab at the solution is ./ont which combines blockchains, protocols, and tokens to give a comprehensive view of a Blockaverse portfolio.



Friday, April 5, 2024

Ontological pop-quiz: map blockaverse portfolio

#ontological pop-quiz #cryptocurrency 

Now that I (and you, ... right?) have captured every position in every protocol of every blockchain, ...

Map an ontology of your portfolio across the blockaverse.

Use whichever knowledging engineering-tool you prefer.

I'm not joking.

Thursday, March 7, 2024

Rust pop-quiz answer: tabla

In answer to the Rust pop-quiz about HTML-formatting data tables, ...

Behold! ./tabla.




Most of the work to effect this was done in the html_utils book lib where you see the BONUS section (right justify numbers) is handled there, as well. 


Wednesday, March 6, 2024

Rust pop-quiz: enHTMLTablify data rows

#Rust pop-quiz.

Do you see this tweet?

Turn these data:

Token amount value
USK 210.84 $210.63
LUNA 179.0488 $204.456
axlUSDC 47.642972 $47.64

into an HTML-table.

BONUS: If the input-datum is USD, right-justify that cell.

Tuesday, March 21, 2023

Investment by Blockchain: 2023-03-21

Investment by Blockchain: 2023-03-21



invested: $94,900.87
value: $96,506.61
ROI: 1.69%





bar chart of protocols generated with ./bar.
voronoi chart, same.

Thursday, March 9, 2023

Rust pop-quiz: portfolio visualization

Rust pop-quiz!

Inspired by @_ZRho_ 



  1. You have your portfolio (you know: your coins and how much of each, right?)
  2. You have this: (Observable tree-map)

Convert A. in to B., ... RUSTILY! (that's a word, now)

Friday, March 12, 2021

Friday, March 11, 2016

TODO: Collect Libraries, Write Paper on Clustering and Graphing Heterogenous Data

You have this:




You need a better representation, like this

Which means you need to collect those data then scale them. Then you can look at clustering

to get something like this.

TODO: Collect these libraries here. Write this paper.

Wednesday, February 17, 2016

Our Daily Scrape, a recipe

Our Daily Scrape, a recipe

Step 1: Take a snapshot of the database; archive it

See the excellent article, written by the all-around good guy, here (url: http://logicalgraphs.blogspot.com/2016/02/backup-plan9-from-outer-space.html)

Step 2: Scrape

Scrape – described at the bottom of the Trading Analytics tab http://logicalgraphs.blogspot.com/p/trading-analytics.html – is an application that scrapes the top5s securities lists from google finance and saves the results in two places: a graph database (configuration in the environment) and a semi-structured matrix of historical top5s http://lpaste.net/4714982275408723968

The methodology of scrape is this. After the trading day, at 6 pm-ish, you execute scrape:
geophf:writing geophf$ scrape
And it does its thing (see below under 'enscrape').

Now, if you, like I often do, sleep on your keyboard and wake up after midnight do not run scrape! But instead run enscrape with the previous day's date as the argument: the top5s are for yesterday, not today, so we wish to enter those data for that day:
geophf:writing geophf$ enscrape 2016-02-16
######################################################################## 100.0%
Saved to /Users/geophf/Documents/OneDrive/work/1HaskellADay/Seer/sources/google/2016-02-16-index.html ...

2016-02-16
Mkt_Cap:AAPL,BABA,MSFT,GOOGL,LMCB|QVCB,AIG,FB,ABEV
Price:ADT,GRPN,CRAY,LPLA,CSIQ|NUGT,CYH,STRZB,BVN,LMCB
Volume:BAC,ADT,QQQ,CSCO,SIRI,SPY,INTC,IBN,KGC,ETP
Updated /Users/geophf/Documents/OneDrive/work/1HaskellADay/Seer/data/top5s.csv with 2016-02-16 data
HTTP/1.1 100 Continue

HTTP/1.1 200 OK
Server: nginx
Date: Wed, 17 Feb 2016 09:18:38 GMT
Content-Type: application/json
Content-Length: 125
Connection: keep-alive
Access-Control-Allow-Origin: *

{"results":[{"columns":[],"data":[]},{"columns":[],"data":[]},{"columns":[],"data":[]},{"columns":[],"data":[]}],"errors":[]}

Saved 2016-02-16 top 5s to GrapheneDB

The 'thing' is this: you must run scrape/enscrape before the markets open the next trading day. As soon as the markets open the top5s for the previous day go away and start to fluctuate with the market, minute-to-minute. 

Scrape after 6 pm, enscrape before 9 am (hopefully before 8 am) and that your window; don't screw up the data by violating that window.

Fer realz, yo.

Step 3: Capture Top5s Data in the Daily Report

So, you have your daily reports – e.g.: http://logicalgraphs.blogspot.com/2016/02/2016-02-12-trading-top5s-securities-ge.html – divided into two parts: the reportage and the analysis. The reportage is this:

Copy and paste the top5s for the day into the report. That is, from the above scrape/enscrape run-off, copy:
2016-02-16
Mkt_Cap:AAPL,BABA,MSFT,GOOGL,LMCB|QVCB,AIG,FB,ABEV
Price:ADT,GRPN,CRAY,LPLA,CSIQ|NUGT,CYH,STRZB,BVN,LMCB
Volume:BAC,ADT,QQQ,CSCO,SIRI,SPY,INTC,IBN,KGC,ETP
Updated /Users/geophf/Documents/OneDrive/work/1HaskellADay/Seer/data/top5s.csv with 2016-02-16 data
... into the daily report.

Open up your graph database and get a screen shot of today's top5s with the previous day's top5s categories expanded to see interesting day-to-day trends (precursor to analysis), e.g.:

Note in the above screen shot that before I did scrape, I exported a snapshot of the database (then shunted that export off to my company's google drive).

Step 4: Analysis

Note that went you expand and tease apart the graph of today's top5s, Some Stocks Start to Stand out Stupendously (I call it the S5-effect) (I just invented that, actually). Pick the one that's of interest to you.

interest, n.: 1. what you don't get on your money in a savings account anymore
2. whatever is of interest to you, see: 'interest.'

That's very ... 'helpful'! NOT! 

So, to help in a substantive way, I am developing tools to automate the 'feelz' for what's interesting – particularly the Repeatinator2000! http://lpaste.net/781423227393015808 and the new, improved GAPINATOR3004!! http://lpaste.net/5017845158461308928 – but these are very much alpha-stage tools at present, so you have to come up with or develop with practice your own feel for what looks interesting to you for now.

You know: make your own decisions, ... liek: on your own, liek.

Today, I picked out LMCB as it has multiple connections, and I hadn't seen in before.

When you pick a stock, run it through analyze, a program described at the bottom of the Trading Analytics tab: http://logicalgraphs.blogspot.com/p/trading-analytics.html
geophf:writing geophf$ analyze LMCB
analyze: Ratio has zero denominator

Okay, whoopsie! This does happen (like twice in the last nine months), and it happens on johnny-come-latelies to the top5s list, that is, possibly, newly minted billion+-dollar companies that don't have 3 months of trading history.

Possible? Maybe? Maybe they just went public, or maybe they changed stock symbols and their old trading information doesn't carry forward?

I don't know. I don't care. I just move on and pick a different stock to analyze.

So, missed opportunities here? Perhaps. And to convince me of that, write a white paper on how I am missing out big-time on these rare opportunities.

Anyway.

So, let's regroup. I just picked BAC because it had some good things going, but, in retrospect (i.e.: if after I had slept on this, perhaps), maybe LPLA would've been an interesting case for analysis.

The Markets: so many interesting case studies! So little time!
geophf:writing geophf$ analyze BAC
Wrote analysis files for BAC
The analyze tool spits out three CSV files: BAC-EMAS.csv, BAC-kds.csv, and BAC-SMAS.csv. Since these are comma-separated value files, you can easily load them into a data visualization tool of your choice (e.g.: Excel for you, maybe. Me? I use Numbers, because I'm not stupid: I own a Mac), then take screen shots of your analytics results. You can read up on what SMAs, EMAs and the %K vs. the %D lines of Stochastic Oscillators mean on investopedia, e.g.: here's the write up on SMAS: http://www.investopedia.com/terms/s/sma.asp 

With this completed report, I blog it (sample link at the top of this recipe article), and also tweet the graph and three charts on our company's @logicalgraphs twitter account.


Easy-peasy!

Saturday, February 13, 2016

Modeling Order Lifecycles with Graphs

Problem

The stock market is a large, complex system, which, due to its size and complexity, is difficult to visualize in meaningful ways: data is either too numerous to be useful or the data is portrayed in ways that only experts can decipher, e.g.: as spreadsheets.

What if this?

What if it were possible to trace the lifecycle of an order, from when the buy or the sell was placed to the execution at the exchange?

Nice dream, and, for over 90% of order lifecycles, entirely feasible: most trades from start to finish have a total of four transactions:

1. Order placed by the individual
2. Order consolidated by brokerage firm
3. (meta)Order placed at the exchange
4. Order executed

Simple.

What's so hard about that?

Two things:

1. One (simple) order is easy to tackle, but exchange data comes at the rate of 6 billion transactions per day. How do we handle the sheer volume of data what would cause most databases to falter on just one day's worth of data?

2. Some orders are not so simple. With computer trading, the order lifecycle can contain over 1 billion transactions for just one order as the computers track the volatile price of a security through its ups and downs with continuously placing and cancelling orders until the exact price is matched to the exact amount that maximizes profitability for the person or corporation making the trade.

Solution

What are we doing to address these database-killing concerns?

Nothing. HA!

No, really, that's our solution.

Up to this point solutions to the stock market-problem have been focussed around capturing these transactions and then, once captured, being able to reassemble the trade in a meaningful way and in a timely fashion. Now, thanks to FINRA's novel approach of capturing these data, half the problem is solved: storing these data is feasible, and retrieving these data is fast.

Good show.

But, its representation?

Up to now, orders have been reassembled as rows in spreadsheets. This representation is a problem, however: it tacitly views an order as a straight-line progression from start to finish.

For the most part, that is: for the vast majority of trades, this is not a 'problem' at all, as the order lifecycle for most trades is indeed linear: the order is placed, the order is consolidated, then the order is executed.

But, for the more complex cases, that is: the more interesting trades, the order lifecycle can contain mid-stream additions, subtractions, and joins between brokerage houses with other orders, and this complexity makes the idea for these orders are linear, or even a tree, a fallacy: there is no single origin, and, in these cases, an order can be distributed over multiple executions, so there is no single conclusion.

This is not linear, nor is this structure a tree: multiple origins and exits are best represented by a graph, not the straight line of rows in a spreadsheet tabled-representation.

Let's take a couple of examples and show how this bears out in practice.

Your 'Joe Average'-trade:

[figure 1: Joe Blow Schmoe Chloë]

Okay, you see here the linearliness of an ordinary trade.

No. Big. Deal.

Or. Is. It?

What you see here, and what you don't, is the compactness of this trade. By being represented as a graph, it can start from its origin: the buy or the sell order, if the analyst doesn't wish to see anything more than that, then they move onto the next trade, their screen not cluttered with data they do not wish to see.

What if they wish to see the data?

Then, in that case, they expand the origin, getting the simple set of related transactions, these transactions can be drilled into extracting the specifics of the data, or they can be left as is, keeping the data contained and the screen clear to show simply the flow of the trade.

The Spreadsheet

"If you live by the spreadsheet, you die by the spreadsheet."

Cases live and die on the spreadsheet, can the graph of a trade be exported to a spreadsheet?

Why, yes. Yes, it can.

[figure 2: spreadsheet ... so teh borin'z]

Okay, we've put that one to bed.

But what about complex trades? Or really, Really, REALLY BIG-HONKIN' trades?

How do we handle those?

Complex/Nonlinear Trades

See, now if someone wants to get down and dirty with a trade, that's the point where a spreadsheet has to throw up its hands and go hide under the covers.

But for graphs?

This is where graphs shine:

[figure 3: sparkle and shine on you crazy diamond]

With a complex order, we see that, yes, we start with a single entry point – the one that we know for this order – but as we expand the flow of trade, discovering the transactions of it, we see more and more entry points which then resolve to multiple exit points.

Gosh! Trades aren't the nice and simple things that I want them to be! But with the graph-representation, we capture that complexity and show it, firstly: accurately, and secondly: at staged levels of complexity that I, the analyst, and willing the drill into ... and, importantly, at not the complexity that I am not desirous to see.

BIG-OLE Trades

Now, showing BIG trades (100s+ of rows, to 1000s, to millions, to a billion rows) ... are there any problems with that?

Well, yeah. Obvs.

Let's discuss, firstly, the problem of show big trades in spreadsheets.

The problem: just too much. You get just too much data and a lot of those data, during certain times during the inquiry are not at all interesting to the analyst. What do I want to see, right off the bat, as the analyst?

Firstly, am I investigating the right trade? Is the time correct, the trader correct, and how many transactions do I need to see these data? One. The graph of any inquiry starts with just one node, not 100 rows of data paged in at 25 rows at a time: too much information can overwhelm the analyst.

What's the next thing I want to see as the analyst? When the trade is executed and the details of that execution. How many rows do I need to see that? One. How many rows does a spreadsheet show you to get the execution of the trade?

All teh rowz. Alles o' dem.

You page through, then page through, then page through this trade, one painfully refreshed page at a time to get to that very last row, which was all that you cared about, and how much brain-capital and time did you waste to get to the last row?

Now, a smart analyst can set the filters and look for the EX-row that pops right to the top.

How many analysts do that in practice? Right now? How many?

None? One? Two?

ALLES TEH ANALYSTS 'CUZ DEY SO PERFECT?

How many?

The problem with a system that provides features is the assumption that the user-base will, firstly, see them, and then, secondly, use them. In practice, this rarely, if ever, happens.

Why not this? Instead of presenting alles tehz daterz that the user has to shift through, manually, or be smart enough to filter out, optionally, just present the data visually by importance.

[figure 4: teh big win]

Here we see a transaction of 27,324 rows, first as one transaction, then as three nodes: the origin, the 'everything else in between' and then the execution.

Simple.

And, if, and when, the analyst wish to drill into the 'everything including the kitchen sink' set of transactions, the analyst can do that.

When they want to.

But there it is, right at their fingertips everything vitally important about an order lifecycle right up front, visually, in a very simple, easy-to-understand representation.

And can you save this order lifecycle out to a spreadsheet?

Yes. Yes, you can.

[figure 5: big ole spreadsheet]

Implementation

Okey-dokey (that's a technical term). So, but how do we do it?

We're not here to reinvent the wheel. FINRA has done the discovery and invention already. We're here to provide a meaningful and accurate representation of the order lifecycle of a security, and we'll use FINRA-processed data to do it.

[figure 6: tehz architecturez]

(hive)->(red shift)->(database)
                                    |
                                    v
                               (graph)

All of this architecture up to the graph database has already been designed and implemented by FINRA, so, by the time the analyst requests an order lifecycle to examine, it is already right-sized to contain the transactions of that OLA and that OLA alone. Uploading those transactions and linking them in the graph database takes from no-perceived time for small OLAs to a few seconds for 1000+-transaction OLAs (and these few seconds can be inlined with the hive-query, effectively giving the analyst the graph-representation 'for free' from the user experience).

When the analyst views the summarized OLA they make the determination what to drill into and examine further, and how do that, and when they want to do that. If, on summary inspection, they determine that these are not the transactions they are looking for and want to move along, move along, then, this, too, is simplicity in and of itself: the graph database flushes that OLA from the data store and loads the already realized next graph into the database, in sub-second time.

Easy-peasy (a technical term).

Technical Concerns

"It can't be done."

Yes, it can. Or: what can't be done? Modelling an entire exchange's trades for a day as a graph? Yeah, I'll grant you, that's hard, but that's not what the analyst wants nor needs: the analyst is assigned a set of OLAs to review and beyond those trades is not interested in how every other trade in the markets are doing. If there is that concern, there are other very good tools that FINRA has to answer questions along those lines: the purpose of this business is data visualization of the Order Lifecycle Assembly, not all and every trade of every security.

Or: "it can't be done" being: "some OLAs are too big for graph databases."

No, they aren't.

Or, put another way: who is going to look at one billion transactions all at once and know that they need to go right to row 3,456,123 to see that, Ah, yes! THERE is the fraudulence! I got'm!

No, putting a case together is an iterative process of building a case from relevant transactions, and such a trend is observed over a (relatively) small subset of data: this upspike is telling or that downswing is crucial.

These trends are better represented by other tools than graphs, when you are looking for trends, and we got those for you:

[figure 7: teh spreadsheet graph. yayz]

If you need a billion rows for your case, then we can have one node represent 

(:TRANSACTIONS { rows: 1,656,332,445 })

Was that hard? How much memory did that take?

And you want to drill into that? Simple, we expand the graph on an as-needed basis as you drill into the relevant nodes of interest.

Summary

Order Lifecycles are graph structures. Graph databases give you the tools to visualize these graphs meaningfully outside the same-old world of OLAs-as-spreadsheets and give you the fine-tuning controls to throttle when and how much data is coming at you.

While other companies are 'considering' graphs as solutions and 'looking at' the graph database-option, our company has set up graph databases for both U.S. Government customers as well as for commercial clients, so we understand the various levels of technical and managerial skills and vision for visualization products and we also understand the need for relevant data, now, and show in an effective way. Graph databases have given our customers what they want and even beyond their expectations of the technology: once you can see what you couldn't see before in your data, it then becomes useful for tasks needing to be addressed now, but also for new work never imagined before.

FINRA is in desperate need of a visualization tool that displays Order Lifecycles accurately and usefully.


Choose us, and be very impressed.

Tuesday, December 8, 2015

Executive Summary

Company Information

Logical Graphs LLC works with Big Data in various domains, including the stock market and exchanges, person-relation data sets, and transactional data. We analyze these data, find patterns, clusters, and relations, and present these results to our customers who then run campaigns, examine the markets (primarily for anomaly detection or non-conformance).

Products/Services

We use a NoSQL-approach to data collection and analysis. We have used HADOOP/HIVE and are currently focused on graph technologies, using neo4j as our graph database.

Our customers are both Government and Commercial clients that are realizing that they have Big Data, yes, but also a Huge data problem: that problem is that seeing relations and patterns in the data are hard or require experts, but seeing those patterns is vital to the execution of their mission or the effective and efficient running of their campaigns.

We, at Logical Graphs LLC, can help here. We have experience in grasping what the problems are with and in the currently existing data sets. We remodel the data in ways that speak the the problems needing to be solved at hand. We graph these data, exposing heretofore hidden relationships and then present the results that tells the story the data are trying to tell.

Using the above methodology:
  • With requirements-as-graphs, we helped our customers rein in over-budget and past-due projects, focusing in on the high-impact requirements to deliver the most bang for the buck
  • With personal-relations-as-graphs, we helped our customers target impact players, focus in on key issues, and run effective campaigns to influence policy and decisions
  • With the historical data of the markets, we have identified interesting areas of the market which lend themselves to further data analysis
  • With the Regressive Imagery Dictionary, we model the semantics and intents of documents, extracting the underlying meanings


Of course, if there's no report on the data and their findings, it's of no general use. Data analysis, if not presented or summarized well, can lead to no useful action being taken.

Report generation and synthetic data generation are our speciality.


Summary

You have data problems, not in storing and managing the data: modern databases handle that quite well for you. But what does it all mean? And how do you get it presented to your senior management so you can put it into the hands of your users so that they can be effective in their jobs?

That's where Logical Graphs LLC comes in. Let us present your data to you in ways you've never seen it before. Let us open up new opportunities for you that your data have hidden inside structures and relations waiting to be discovered.