Skip to main content

Sharing predicted crypto prices with URIs

· 3 min read
Stable Diffusion: a brain made of colorful metal chains connected to another brain made of chains, synth wave, floating in space Seed-9862102 Steps-25 Guidance-7.5
Jeremiah Cheng
JJ Brosnan
Deephaven's URI package makes sharing tables easy

Last week, Deephaven announced its URI package. A URI is a sequence of characters that identifies a resource on the web. Think of a URI as a generalization of a URL. A Deephaven URI identifies a table. By linking to a URI, you share your results with others without them needing to replicate your setup or know the details of your queries.

When you share a URI, it shares your table without sharing any of the work.

It takes one import and one line of code to resolve a URI:

from deephaven.uri import resolve

shared_table = resolve(f"dh+plain://{your_host}:{your_port}/scope/{your_table})

My results

This is the sixth and final blog in the series of real-time crypto price predictions with AI. In this blog, I'll share my results with URIs.

  1. Acquire up-to-date crypto data with Apache Airflow
  2. Implement an LSTM model with TensorFlow
  3. Implement a linear regression model with Nvidia RAPIDS
  4. Test the models on simulated real-time data
  5. Implement the models on real-time crypto data from Coinbase
  6. Share AI predictions with URIs

I've already built, tested, and deployed my AI models. My results are worth sharing, and Deephaven's URIs make it easy to do just that. All I need is the URI for a consumer to resolve.

Share locally

If I want to share my results locally, I need three pieces of information:

  • The container name
  • The port on which Deephaven is being run
  • The table name

In my case, the container in which my predictions were made is called crypto-predictor, the port is 10000, and the table name (as we saw in the previous blog) is real_time_prediction. With that information, anyone with access to my local machine can get my results without having to do any of the tedious work machine learning is known for.

from deephaven.uri import resolve

container = "crypto-predictor"
port = 10_000
table = "real_time_prediction"

jeremiahs_predictions = resolve(f"dh+plain://{container}:{port}/scope/{table}")

Share remotely

If I alone have access to my local machine, then I could share the table across a private network, or even publicly. In this case, I need the IP/hostname of my machine rather than the container name. Just like before, a consumer could resolve my table with a URI:

from deephaven.uri import resolve

hostname = "jeremiahs-computer"
port = 10_000
table = "real_time_prediction"

jeremiahs_predictions = resolve(f"dh+plain://{hostname}:{port}/scope/{table}")

Resolve CSV and Parquet

URIs can also be used to resolve CSV and Parquet files. For the former, they can be resolved from a local or remote source. For the latter, they must be local. Try it for yourself! We have tons of data in CSV and Parquet format over at our Examples repository.

Conclusion

I hope this blog series has given you some inspiration to build cool applications with Deephaven. Whether you want to use AI to predict crypto prices like me, or carve your own path, Deephaven has the tools to accomplish your goals. Don't hesitate to reach out to us on Slack if you have any questions or feedback for us.