Stockmarket tool real time stocks network

Real-Time Financial Dashboard & Chat - Powered by PubNub Real-time Network

PHP and JavaScript:   Real-time Stock Dashboard

Welcome JavaScript and PHP Web Developers!

This is a simple dashboard showing you how to start streaming stock quote data to an HTML5 web browser in Real-time. The source code is open and available under the MIT License. The software is written in PHP and JavaScript. Continue from here to learn more about the basic introduction and getting started.

IMPORTANT: Live Data Streamed from a PHP Server. Please note that this data stream has live data but the numbers are randomized! Do not make financial decisions based on these random numbers that are being streamed to your browser from a PHP Server.

Group Chat

Basic Introduction

JavaScript Include

<script src="http://cdn.pubnub.com/pubnub.min.js"></script>

PubNub - Class Instance

var pubnub = PUBNUB.init({
    subscribe_key : 'demo',
    publish_key   : 'demo'
});

Introduciton Details

This is the first step to initialize the Connection Class which will be used in the following steps below.

The following examples below will show a few more options that will allow you to open TCP sockets and stream only the data that you are interested in. This is called Stream Multiplexing which streams multiple feeds over a single TCP Socket.

You'll want to go much further in depth by reading the Real-time Stock PHP and JavaScript README.md documentation on GitHub.

PubNub - Open Multiplexed Stream

pubnub.subscribe({
    channel : ['MSFT', 'YHOO', 'ORCL'],
    message : receiver
})

PubNub - Stop One Stream

pubnub.unsubscribe({ channel : 'MSFT' })



PubNub - History

pubnub.history({
    limit    : 5,
    channel  : 'MSFT',
    callback : history_receiver
})

function history_receiver(messages) {
    log_messages(messages);
}

History Example

PubNub - GitHub Repository

https://github.com/pubnub/real-time-stocks/

Open Source and free to get started easily by visiting the GitHub Repository which allows you to easily copy the code to your local machine and begin testing.

Do you like this freebie? Want to get more stuff like this?
Subscribe to @PubNub news and updates to stay tuned on great designs.
PubNub Real-Time Network.

Tweet

Previous Post Next Post