Module Development - Prediction Market here we come

Events happening in the community are now at Drupal community events on www.drupal.org.
greggles's picture

I'm about to build a new module and as I started putting "code to .module file" I thought it might be worthwhile to document the process in painfully close detail. Code, architecture decisions, security choices, everything I do.

A lot of people have said something along the lines of "the best parts of dojo screencasts are the parts where people get lost learning how to get out of that state." This would hopefully provide tons of insight into that process of getting lost and finding your way.

The Learning Process

I'd like some input here. I'm thinking a combination of "commit early - commit often", blog posts, Dojo-stylee screencasts, and something else might be good.

The subject matter: Prediction Markets

The ultimate goal is to build a Prediction Market module and perhaps an installation profile. If you are unfamiliar with prediction markets, it's behaves very much like a typical stock market with some small differences. The style of prediction market we will initially build is a "continuous double auction" market based on the Iowa Electronic Markets (IEM). See IEM FAQ for details on that. Understanding of this function is not required to understand module building in general. Of course, if you have ideas on how to make it better as a prediction market module that will help me along ;)

Initial Requirements

We'll need some sort of a banking system, objects to represent the contracts that can be traded, objects for trades themselves, transaction management to match up trades and validate they worked properly (and rollback if not), state management for contracts and trades, graphing, alert messaging, serious thought about scalability, and eventually some ajax to keep the interface snappy.

Are you interested in following along on this project? If so, what means of sharing information do you think would best help you to learn from this project?

Edit: I have now set up Open Prediction Markets to host my blogging/imgaes/ideas on the subject. If you want to stay in the loop on this, that is the place to subscribe to the feed

Comments

very interested

mike stewart's picture

very interested. perhaps setting up another group just for this project? Or a project on drupal.org?

--
mike stewart { twitter: @MediaDoneRight | IRC nick: mike stewart }

certainly a project

greggles's picture

Yes, this will certainly have a project on d.o but I don't think that's the best way to share things like random thoughts and images.

Since I plan to try to build a community around the product (see ubercart.org for example) I plan to use that site for anything that can't/shouldn't be handled via the project.

Thanks for your interest.

--
Knaddisons Denver Life | mmm Chipotle Log | The Big Spanish Tour

Awesome!

SamRose's picture

Interested in seeing Prediction Market module, and in learning about module development in general, so this is fantastic!

Sam Rose
Social Synergy
Blog

Sounds like a great collaborative workshop for the Dojo

gusaus's picture

This would provide some much needed 'project oriented' learning for the Drupal Dojo. In terms of a process - I think some of that will be figured out as we build out Drupal Dojo 2.0 (http://drupal.org/project/drupal_dojo). Great suggestion greggles!

Gus Austin
PepperAlley Productions

Gus Austin

update on market module

greggles's picture

Well, there's a couple updates for y'all:

1) I've set up a site for this at Open Prediction Markets and am about the progress so far. I edited the initial node to include a link to that as well. In particular there is an explanation of the current state of the code.

2) The module is in CVS and has a project page - http://drupal.org/project/market

So, we're under way and rolling along. Please let me know if there is another format that I can share more information that would be helpful. I'd like to get a little further along in the module development before holding a screencast session.

Greg

--
Knaddisons Denver Life | mmm Chipotle Log | The Big Spanish Tour

Userpoints as the bank?

kbahey's picture

It is interesting that you are using userpoints as the repository for 'money'. Or is it more than that?

I hope you are using the 3.x API not the older ones.

Drupal performance tuning, development, customization and consulting: 2bits.com
Personal blog: Baheyeldin.com

Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.

userpoints as bank (and more?)

greggles's picture

Hi Khalid,

I guess Jacob mentioned it or you read that on the initial drawings and musings post. I thought about using userpoints not just as the bank but also to record the number of each contract that people own using categories to keep track of money points vs. contract points. In the end I decided against that mostly because terms can't have any metadata (like whether the contract is open for trading) and also from a fear about performance of the taxonomy system if it had thousands of terms in it. I know g.d.o has thousands of terms in it and seems to perform reasonably well, but I have also seen sites with thousands of terms where the longest queries were always the queries that involved the term_node/term_data tables.

And yes, I'm using the 3.x version. So far so good. I found a few small features/usability enhancements that are patches in the queue. The migration of expiration into the core of userpoints is a small problem for me (I never want expiration - I want the reverse: interest on points) but I think I can just hide the expiration stuff and make it OK.

I'd love to hear your feedback about userpoints as a bank and also as a possible storage for the contract accounting.

Regards,
Greg

--
Knaddisons Denver Life | mmm Chipotle Log | The Big Spanish Tour

similar project

vacatola2's picture

My buddy and I worked on a Drupal prediction market module for a master's class semester. It's still buggy, but you can see/use it at http://www.vacatola.com/drupal. I hope you like it.

very cool

greggles's picture

So, any chance of contributing the code back to the repository (or at least sending it to me via email so I can review it and try to get ideas and/or merge the projects)?

--
Knaddisons Denver Life | mmm Chipotle Log | The Big Spanish Tour

sure

vacatola2's picture

We've talked about making a contribution out of it, but we want to at least get our grade first :) which should be pretty soon

workflow module advice

greggles's picture

Well, I've gotten the basics working now, but I need to get more complex with workflows now.

I posted my wants with workflows and am looking for advice from other people.

I'm currently testing out each of the different choices and will post a followup with the results.

--
Knaddisons Denver Life | mmm Chipotle Log | The Big Spanish Tour

@ greggles

Walrasian's picture

Hello greggles, can you give us a quick update where you stand on this module?

-- Bert