Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7509073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:47:58+00:00 2026-05-29T22:47:58+00:00

We’ve just started using Backbone and I’m trying to get a handle on a

  • 0

We’ve just started using Backbone and I’m trying to get a handle on a nice way to structure my application.

So we have a web application that’s essentially a trading platform. In ASCII art, the interface (and data), looks like this:

Market name

------------------------------------
Contract 1 | 12 / $100 | 15 / $150 |
------------------------------------
Contract 2 | 40 / $400 | 42 / $650 |
------------------------------------
Contract 3 | 46 / $620 | 47 / $700 |
------------------------------------

Where each contract is a child of a market, and the two cells next to each contract are the current BUY and SELL price and “quantity” (amount of money available). There may be more than 1 Market per page, and it might be in a different template (i.e a list view with only a single “favourite” quote instead of the entire list of contracts etc.)

We aren’t using Routing as this stuff is read-only on the frontend and initial payload is via HTML, the rest comes in on WebSockets.

The interface is highly variable, for instance: the two cells there (BUY / SELL) can be arbitrary depth, i.e show 3 ticks on each side. Or might only show one side (the available BUY quotes).

What I’ve currently got is a Backbone Model for Market, Contract, and Quote. Then I have a MarketContracts collection for the list of contracts, and a MarketDepthQuoteCollection for the BUY/SELL lists (collapsed as a single list).

The market > contract > quote hierarchy is strongly tied to the way the data is represented in the API, so that’s non-negotiable.

Updates to the interface land as WebSockets messages containing a JSON structure like:

{marketid: [{contractid: [[buy quotes], [sell quotes]]}],...}

as this is the most compact way to represent the data over the write without using a binary format.

Is there a better way to structure this and tie up all my listeners nicely? Ideally I want the Contracts and Quotes listening for Market model changes to update themselves, and I need to easily hand off state changes from Websockets to each quote in the table.

I’m also confused about where Views fit into this to make my life easier.

Are there any good example apps or advice? I’ve been struggling to find information.

Edit: here’s a screengrab of the interface I’m talking about. It shows one whole market and part of a second market:

Market interface with quotes

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T22:47:59+00:00Added an answer on May 29, 2026 at 10:47 pm

    So, you have a collection of Markets; each with a collection of Contracts; each with a collection (or two) of Quotes. This seems pretty logical. You could look into using Backbone-relational.

    I would suggest using pretty granular views. Since a Market contains a collection of Contracts, your MarketView will create/display a collection of ContractViews. And each ContractView will create/display a collection of QuoteViews.

    This way, when a QuoteModel changes, only the QuoteView listening for its change events will need to be updated.

    Now, how you get your data into your models might require some adapter to parse it, since your data comes periodically via a websocket (and all in a big chunk). Normally, you would call the fetch template method for some model or collection only when you want new data. But, as long as you get the new data into the model attributes via set() or reset(), the views listening will update.

    Here are some good links:

    http://aaronhardy.com/javascript/javascript-architecture-backbone-js-views/
    https://github.com/addyosmani/backbone-fundamentals

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have thousands of HTML files to process using Groovy/Java and I need to
I'm trying to create an if statement in PHP that prevents a single post
I am using Paperclip to handle profile photo uploads in my app. They upload
I am trying to loop through a bunch of documents I have to put
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.