You are here

first prediction market checkin to Drupal cvs

Submitted by greggles on Fri, 12/21/2007 - 11:51

So, I just did the first checkins of code into the cvs repository for Drupal.

There are two things that I think people should get out of this set of code:

First, I tend to just copy an existing file and then delete a bunch of stuff out of it to create new modules. I sometimes use the module builder but generally just start out by copying an entire module directory, renaming the files, renaming the functions, and calling it done.

Second, especially at the beginning I do a lot of //TODO something kinds of things. Basically the process is that as I'm working on some bit of code and I'm in a particular line of thought, an idea will come to me of some other thing I need to do. Rather than derailing my current thought process, I will write a quick //TODO comment to remind me of it and then get back to what I was working on. The hook_nodeapi is kind of full of //TODO at this point:

// TODO for trades:
// TODO if it's a contract buy/sell set the price to 1 and give them a dsm
// TODO Validate the order prior to submit to make sure they can currently enter it
// buy orders need to have enough money
// sell orders need to have the shares
// TODO state the upside/downside of the position prior to submission
// TODO for contract groups:
// TODO some ability to open/close trading on a group
// TODO for contracts:
// TODO On load pull up last price

And that's just the beginning!

I tend to use TODOXXX to mean stuff I really need to do MAYBEDO for things that aren't so important.

That's about it - leave comments here if you have any questions or ideas. And please don't download this and expect it to do anything legitimate just yet!

Edit: I changed the title to be more explicit that this is about a Drupal prediction market module and not just "the first prediction market checkin to cvs ever." It's not like it's all that groundbreaking so a little more qualification seemed appropriate


I'm the primary author of Zocalo, an open source prediction market package written in Java. People have suggested a few times that it would be useful to integrate Zocalo with Drupal, and I've done a little looking around to see what it would take. Unfortunately, I haven't been able to find the simple guide to integrating a Java package into Drupal, so I haven't gotten any further than that.

But I remain interested. Would you be interested in integrating an existing package rather than building a prediction market from scratch? I think if you look around, you'll find there are a handful of other open source prediction market packages, but none of the others have any kind of active development.

My goal in building Zocalo has been to improve the state of the art for prediction markets; I find that many people have time to build the first couple of useful features for a prediction market, but then they get involved in the other aspects of their project, and never build the next several levels of enhancements to their tools. If you'd be interested in a prediction market tool that will continue to grow even if most of the Drupal community moves on to the next important set of features, I'd recommend integrating this package rather than starting from scratch.

I'm happy to answer questions and help with development and integration. If all you want to do is read the Zocalo code and learn from the example there, I'll be glad to talk about what it takes to make a prediction market work.

Thanks for your comment. First, I updated the "about" page so it would link to the other open source prediction market projects that I know about. Previously it just recognized that they exist without saying who they were. If you know of other projects, please let me know so I can add them to that section. I knew when I registered the domain that it was presumptuous to take that namespace when I had no working product, but I couldn't think of a cool name of my own that was available. I do plan to rename the project at some point and will change into a general "open source prediction market portal" at that point.

When I first started thinking about this idea I looked around for existing solutions and at that time the only one I found was Zocalo. My feeling is that Zocalo has too large of a barrier to entry in setup for end-users and for developers. The various tools that Zocalo uses are just not as commonly available on web hosts as is the AMP stack. I also think that it's more difficult to get people integrated with a Java development environment so that they can contribute patches back to the code than it is an AMP environment.

I haven't ever had good results with bridges between software packages, so I didn't consider the idea of building a Zocalo<->Drupal bridge.

I chose PHP/Drupal because they are so common for hosting and easy to learn to build a community of users-contributers. I also clarified this point on the about page.

I do appreciate your offer for assistance in thinking through the design ideas. I think it would be really valuable if you could continue reading (skimming probably, a lot of this will be Drupal specific and may not be of interest) and adding comments. If you would like and it would be valuable to you, I can give you the ability to blog on the site as well to be able to discuss progress with Zocalo.

I agree, Greg. Taking the community, paring out the 99.8% of folks who aren't interested in PM's, and then further pruning out the non-java devs just isn't a good idea.

I'm really interested to see if these guys contribute: Also, as things begin to take on flesh, please feel free to use me as a dev/tester/soundingboard, etc. I'll be rolling PM's (for work) within the next year, I just don't know how I'm going to get there yet. In short, any time you need from would probably be backed by my firm.

Great to hear about your availability for testing and help with the project. And also about your future use of prediction markets.

One thing to note is that I'm not trying to build a prediction market for Drupal users. I'm trying to build a prediction market for anyone who can run PHP+MySQL/PostgreSQL - which should be the majority of the people who want to run a prediction market. The idea is much like ubercart is first and foremost a free open source ecommerce system that just happens to be built on Drupal. We flip the advertising to get "Drupal users looking for prediction market" but more importantly to try to get "Prediction market users looking for the PM system and happen to get a CMS/F."

And I think that the argument still makes sense regardless of which way the marketing works ;)

I'm new to Drupal and CMS / eCommerce development, but it might also be helpful to take a look at integrating Magento. Just a thought.