Is it possible to do a TRANPERFORM with Trancode "SV" in Symitar PowerOn? - financial

I am trying to post a dividend to a share in an on-demand specfile. How can I get the TRANPERFORM command to issue the same teller transaction sequence "SV" just like a teller would? Example code:
TRANPERFORM SV (0,SQ1,SQ2,CHKACCTCODE,CHKNUM,TRANERROR)
DO
SET TOACCT TO ACCOUNT:NUMBER
SET TOTYPE TO "0"
SET TOID TO SHAREID(S)
SET AMOUNT TO SHAREDIVAMT(S)
SET ADJUSTMENT TO 0
END
I am unable to get this to compile and I don't understand why.

Your error is "invalid action code in TRANPERFORM specification". It means the first letter "S" is invalid. "S" action code is not available for TRANPERFORM.
Below are from Episys eDoc 2014.01.
The required Tokens by Transaction:
• A (Loan Advance)
• C (Share or Loan Comment)
• D (Share Deposit)
• GL (GL to GL Transfer)
• KS (Check Stop Payment)
• N (New Loan)
• P (Loan Payment)
• W (Share Withdrawal)
• XF (Transfer)
The Share Dividend (SV)transaction lets you calculate and post a Closing Dividend, Periodic Dividend, Accrual Dividend or Extraordinary Dividend for a share. This transaction updates the share balance by the transaction amount and also updates fields in the Share record.
You can use the Share Dividend (SV) transaction alone or with other transactions. Another transaction is not required to balance a Share Dividend (SV)transaction, since Episys makes the offsetting General Ledger transaction automatically.
Updated Share Fields: the Share Dividend (SV)transaction updates the following Share record fields:
• Last Dividend Date
• Last Dividend Amt
• Dividend YTD
• Dividend From Open
• Ins Balance Age 55
• Ins Balance Age 60
• Ins Balance Age 65
• Ins Balance Age 70
• Dividend Due
Below snippet is from RD.DVTRANSACTION.
TRANPERFORM DV (0,SEQ1,SEQ2,CHECKINGACCTCODE,CHECKNUMBER,ERRORTEXT)
DO
SET TOACCT TO ACCOUNT:NUMBER
SET TOTYPE TO "S"
SET TOID TO SID
SET AMOUNT TO SDIVIDENDDUE
SET ADJUSTMENT TO 0
END
IF ERRORTEXT<>"" THEN
POPUPMESSAGE(2,"Share Dividend error: "+ERRORTEXT)
ELSE
DO
POPUPMESSAGE(0,"Share Dividend: "+
FORMAT("###,###,###,###,##9.99",SDIVIDENDDUE)+
" Posted to Share "+SID)
FMPERFORM REVISE SHARE SID (0,0,ERRORTEXT)
DO
SET DIVACCRUALDATE TO SYSTEMDATE
SET DIVACCRUAL TO $0.00
SET DIVPERIODSTART TO SYSTEMDATE
SET DIVPERIODBALDAYS TO $0.00
SET MTDPRIORRATEACCRUAL TO $0.00
END
IF ERRORTEXT<>"" THEN
POPUPMESSAGE(2,"FMPERFORM error: "+ERRORTEXT)
IF (MAD - SDIVIDENDDUE)>=$0.00 THEN
FMPERFORM REVISE SHARE SID (0,0,ERRORTEXT)
DO
SET MTDACCRUEDDIVS TO (MAD - SDIVIDENDDUE)
END
IF (CDP - SDIVIDENDDUE)>=$0.00 THEN
FMPERFORM REVISE SHARE SID (0,0,ERRORTEXT)
DO
SET CURRDIVPAYABLE TO (CDP - SDIVIDENDDUE)
END
END

Related

Coefplot- Event study plot with two coefficients at time zero

I have an event study I am plotting with coefplot in Stata 13. At time zero, I have two coefficients I would like to plot side by side, group A and group B. I don't know how to format the plot so that both coefficients show up side by side at time zero, without creating two separate plots or having a wide gap between them. Other than the two coefficients at time zero, there is only one coefficient at every other x-axis point. I would ideally like to label both group A and B at time zero with a different color but I can figure that out myself.
Here is the relevant code:
ppmlhdfe f2 ( 2.time 3.time 4.time 5.time zero c.groupA c.groupB 8.time 9.time 10.time 11.time 12.time )#(c.eventstudy_treat) , offset( log_pop_tt) a(i.unit i.month#i.year alltime#eventstudy_treat ) vce(cluster unit ) pformat(%5.4f) eform
Above, #.time is a dummy for each period in the event study where 7.time is "Time Zero". Period T-1 is a reference period represented by zero which is collinear and defaults to 1. groupA and groupB are dummies for treated group A and treated group B at time zero.
Below is my code for coefplot, where only group A is plotted at time zero:
coefplot, omitted keep(2.time#c.eventstudy_treat 3.time#c.eventstudy_treat 4.time#c.eventstudy_treat 5.time#c.eventstudy_treat 0.zero#c.eventstudy_treat c.groupA#c.eventstudy_treat 8.time#c.eventstudy_treat 9.time#c.eventstudy_treat 10.time#c.eventstudy_treat 11.time#c.eventstudy_treat 12.time#c.eventstudy_treat) vertical xlabel(1 "-5" 2 "-4" 3 "-3" 4 "-2" 5 "-1" 6 "0" 7 "1" 8 "2" 9 "3" 10 "4" 11 "5") baselevels eform order(2.time#c.eventstudy_treat 3.time#c.eventstudy_treat 4.time#c.eventstudy_treat 5.time#c.eventstudy_treat 0.zero#c.eventstudy_treat c.groupA#c.eventstudy_treat 8.time#c.eventstudy_treat 9.time#c.eventstudy_treat 10.time#c.eventstudy_treat 11.time#c.eventstudy_treat 12.time#c.eventstudy_treat) title("Event Study") xtitle("Relative Month") ytitle("Percentage Change") ciopts(recast(rcap)) transform(*=(#)-1) ylabel(-.06(.02).16,gmin gmax) yline(0, lpattern(dash) lcolor(gs0))
Picture is at:
https://i.stack.imgur.com/z4ZxW.png
How do I plot group B as well at time zero so that both groupA and groupB are plotted at time zero right next to each other? The group B coefficient is c.groupB#c.eventstudy_treat.

broker.backtesting [DEBUG] Not enough cash to fill 600800 order [1684] for 998 share/s

I am using optimizer in Pyalgotrade to run my strategy to find the best parameters. The message I get is this:
2015-04-09 19:33:35,545 broker.backtesting [DEBUG] Not enough cash to fill 600800 order [1681] for 888 share/s
2015-04-09 19:33:35,546 broker.backtesting [DEBUG] Not enough cash to fill 600800 order [1684] for 998 share/s
2015-04-09 19:33:35,547 server [INFO] Partial result 7160083.45 with parameters: ('600800', 4, 19) from worker-16216
2015-04-09 19:33:36,049 server [INFO] Best final result 7160083.45 with parameters: ('600800', 4, 19) from client worker-16216
This is just part of the message. You can see only for parameters ('600800', 4, 19) and ('600800', 4, 19) we have result, for other combination of parameters, I get the message : 546 broker.backtesting [DEBUG] Not enough cash to fill 600800 order [1684] for 998 share/s.
I think this message means that I have created a buy order but I do not have enough cash to busy it. However, from my script below:
shares = self.getBroker().getShares(self.__instrument)
if bars[self.__instrument].getPrice() > up and shares == 0:
sharesToBuy = int(self.getBroker().getCash()/ bars[self.__instrument].getPrice())
self.marketOrder(self.__instrument, sharesToBuy)
if shares != 0 and bars[self.__instrument].getPrice() > up_stop:
self.marketOrder(self.__instrument, -1 * shares)
if shares != 0 and bars[self.__instrument].getPrice() < up:
self.marketOrder(self.__instrument, -1 * shares)
The logic of my strategy is that is the current price is larger than up, we buy, and if the current price is larger than up_stop or smaller than up after we buy, we sell. So from the code, there is no way that I will generate an order which I do not have enough cash to pay because the order is calculated by my current cash.
So where do I get wrong?
You calculate the order size based on the current price, but the price for the next bar may have gone up. The order is not filled in the current bar, but starting from the next bar.
With respect to the 'Partial result' and 'Best final result' messages, how many combinations of parameters are you trying ? Note that if you are using 10 different combinations, you won't get 10 different 'Partial result' because they are evaluated in batches of 200 combinations and only the best partial result for each batch of 200 combinations gets printed.

Opencart change product price upon user order

I hope my Q will make sense but I am really out of ideas.
I will explain by example: http://www.xtdeco.ro/fototapet/texturat/Bloom-R12241-6
There is a standard product, with some attributes.
What I need to do is make this product configurable, as you may notice the two text inputs. The plan is to calculate the Lățime*Înălțime, multiply by price / sqm, verify against the actual product price (no problem this far) and then add or subtract a value to the product price, or add a option to the product for the current cart that would do the same.
Is there anyone with a idea of how this could be done without hacking to much of the sources?
Thank you.
The easiest way is to not let the user to input his concrete dimensions but to let him choose from prepared one.
If this is a wallpaper and You know the role of this wallpaper is always only 1m wide (just for simplicity) then for example sell only this 1m2 and let the user to enter the amount of pieces which will result in that long piece cut from the role (so 8 piecese (m2) ordered result in 8m long piece of role that is 1m wide). In this case You may change the word pieces or quantity for m2.
If this is a wall print with concrete dimensions (or aspect ratio), let the user choose from some predefined sizes, e.g.
XS (120 x 170 cm) + $0
S (150 x 212.5 cm) + $10
M (200 x 283 cm) + $20
L (250 x 354 cm) + $35
XL (300 x 425 cm) + $50
This may be handled by the product options which is again easier than what are You requesting... Don't You think?
EDIT based on comment:
Then there is only one possibility that comes to my mind:
hide the quantity field (don't remove, make it hidden)
create some JS onChange event handling function, that will listen to onChange, onBlur, onKeyUp (whetever) events on both text fields (for dimensions) and this will calculate the resulting area size in m2 which will be shown to the costumer as well as price per that m2 while price per 1m2 is also known and displayed to the customer
this function will also fill the calculated float value into the hidden quantity field so after adding to the cart the cart should contain smth like
4.73m2 WallPrint1 $18.92
(because I was calculating the price $4 for 1m2, thus 4m2 x 4.73 $/m2 = $18.92)
I'm not sure but maybe You will have to edit some other pieces of code to allow You to add float quantity values into cart annd also to order them...

What does interaction of continuous and categorical variable represent (Stata)?

Here is a quotation from a Stata online tutorial: If you want to interact a continuous variable with a factor variable, just prefix the continuous variable with c. http://www.stata.com/capabilities/overview/factor-variables/
They give the following example: smoker#c.bmi.
smoker is a categorical variable, coded as 1 non-smoker, 2 smoker, 3 heavy smoker.
bmi is a continuous variable, body mass index.
When they create interaction term smoker#c.bmi, what does it show and how is it to be interpreted?
It seems to me that smoker is a dummy variable (1/0) [please see the note below]. Please double check the following sentence:
We run a linear regression of cholesterol level on a full factorial of age group and whether the person smokes along with a continuous body mass index (bmi) and its interaction with whether the person smokes [emphasis]
cholesterol = -0.517 smoker + 0.03455 bmi + 0.0245 bmi*smoker + other parts
The coefficient on bmi indicates the impact of bmi for non-smoker whereas the coefficient on bmi*smoker gives the incremental impact of bmi for smoker (i.e. for smoker it is 0.03455 + 0.0245 vs 0.03455 for non-smoker). The significance of the interaction term indicates that impact on cholesterol of bmi is higher for smokers than for non-smokers.
Note: There are three categories of age group, not three categories of smokers.

How to count rating?

My question is more mathematical. there is a post in the site. User can like and dislike it. And below the post is written for example -5 dislikes and +23 likes. On the base of these values I want to make a rating with range 0-10 or (-10-0 and 0-10). How to make it correctly?
This may not answer your question as you need a rating between [-10,10] but this blog post describes the best way to give scores to items where there are positive and negative ratings (in your case, likes and dislikes).
A simple method like
(Positive ratings) - (Negative ratings), or
(Positive ratings) / (Total ratings)
will not give optimal results.
Instead he uses a method called Binomial proportion confidence interval.
The relevant part of the blog post is copied below:
CORRECT SOLUTION: Score = Lower bound of Wilson score confidence interval for a Bernoulli parameter
Say what: We need to balance the proportion of positive ratings with the uncertainty of a small number of observations. Fortunately, the math for this was worked out in 1927 by Edwin B. Wilson. What we want to ask is: Given the ratings I have, there is a 95% chance that the "real" fraction of positive ratings is at least what? Wilson gives the answer. Considering only positive and negative ratings (i.e. not a 5-star scale), the lower bound on the proportion of positive ratings is given by:
(source: evanmiller.org)
(Use minus where it says plus/minus to calculate the lower bound.) Here p is the observed fraction of positive ratings, zα/2 is the (1-α/2) quantile of the standard normal distribution, and n is the total number of ratings.
Here it is, implemented in Ruby, again from the blog post.
require 'statistics2'
def ci_lower_bound(pos, n, confidence)
if n == 0
return 0
end
z = Statistics2.pnormaldist(1-(1-confidence)/2)
phat = 1.0*pos/n
(phat + z*z/(2*n) - z * Math.sqrt((phat*(1-phat)+z*z/(4*n))/n))/(1+z*z/n)
end
This is extension to Shepherd's answer.
total_votes = num_likes + num_dislikes;
rating = round(10*num_likes/total_votes);
It depends on number of visitors to your app. Lets say if you expect about 100 users rate your app. When a first user click dislike, we will rate it as 0 based on above approach. But this is not logically right.. since our sample is very small to make it a zero. Same with only one positive - our app gets 10 rating.
A better thing would be to add a constant value to numerator and denominator. Lets say if our app has 100 visitors, its safe to assume that until we get 10 ups/downs, we should not go to extremes(neither 0 nor 10 rating). SO just add 5 to each likes and dislikes.
num_likes = num_likes + 5;
num_dislikes = num_dislikes + 5;
total_votes = num_likes + num_dislikes;
rating = round(10*(num_likes)/(total_votes));
It sounds like what you want is basically a percentage liked/disliked. I would do 0 to 10, rather than -10 to 10, because that could be confusing. So on a 0 to 10 scale, 0 would be "all dislikes" and 10 would be "all liked"
total_votes = num_likes + num_dislikes;
rating = round(10*num_likes/total_votes);
And that's basically it.