Skip to the content.

Publishing a stream

Here’s how to add to the list of streams.

1. Python

from microprediction import MicroWriter
mw = MicroWriter(write_key='YOUR WRITE KEY HERE')
mw.set(name='my_stream.json',value=3.14157) 

See publish-using-python for more utilities and patterns.

2. R

library(httr)
httr::PUT(url = paste0("https://api.microprediction.org/live/", 'my_stream.json'),
              body = list(write_key = 'YOUR WRITE KEY HERE', budget = 1, value = 3.1457))

See Fred Viole’s r_examples.

3. Julia

r = HTTP.request("PUT", "https://api.microprediction.org/live/my_stream.json";
query=Dict(
    "write_key" => 'YOUR WRITE KEY',
    value => 3.14157))
JSON.parse(String(r.body))

This example is from Rusty Conover’s Julia Client.

4. API

Send a PUT request to https://api.microprediction.org/live/my_stream.json with the following parameters in the payload:

Before you publish

Get your writekey of difficulty 12 at least, and learn about bankruptcy.

After you publish

-+-

Documentation map

electricity