diff options
Diffstat (limited to 'app/trading/forms.py')
-rw-r--r-- | app/trading/forms.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/app/trading/forms.py b/app/trading/forms.py new file mode 100644 index 0000000..60c6de6 --- /dev/null +++ b/app/trading/forms.py @@ -0,0 +1,25 @@ +from django import forms +from django.forms.utils import ValidationError + +from .models import LuxOptionContact + +class LuxOptionsForm(forms.ModelForm): + contracts = forms.IntegerField() + + class Meta: + model = LuxOptionContact + fields = [ + 'symbol', + 'strike_price', + 'expiration_date', + 'contract_open_price', + 'call_put', + 'contracts' + ] + + def save(self, commit=True): + i = 0 + while i < int(self.cleaned_data['contracts']): + print(i, "contracts") + i = i+1 + return super(LuxOptionsForm, self).save(commit=commit) |