[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ta-lib port with swig

BENI

3/13/2007 10:06:00 AM

ta-lib is a collection of math/statistical function library for price
variability analysis written in C.

There is no port availiable for it in ruby.

Since i badly needed one .. so i started researching on.

I went along the pickaxe book.
since there are about 120 odd functions to port .. I was thinking to
embark upon the SWIG.

I read along the SWIG docs and ruby mailing list for hints but
somehow could not zero upon how to kick start.

one of the function header looks like this
=========================
TA_RetCode TA_MA( int startIdx,
int endIdx,
const double inReal[],
int optInTimePeriod,
int optInMAType,
int *outBegIdx,
int *outNbElement,
double outReal[],
)
==========================

this is called from c in this way

=======================
Lets say you wish to calculate a 30 day moving average using closing
prices. The function call could look as follow:

TA_Real closePrice[400];
TA_Real out[400];
TA_Integer outBeg;
TA_Integer outNbElement;

/* ... initialize your closing price here... */

retCode = TA_MA( 0, 399,
&closePrice[0],
30,TA_MAType_SMA,
&outBeg, &outNbElement, &out[0] );

/* The output is displayed here */
for( i=0; i < outNbElement; i++ )
printf( "Day %d = %f\n", outBeg+i, out[i] );
==================================

given this I was wondering If I would need to write some typemaps for
SWIG or the typemap.i inclusion will be sufficient?

Specifically....

In the C function above the <const double inReal[]> argument is
passed as &closePrice[0] ... In ruby i won't be able to do that... I
will have to pass in an array containing.... double.. how do i do that
using typemap?

==============

Cheers

Rajib

31 Answers

Gary

4/28/2013 11:04:00 PM

0

On Sun, 28 Apr 2013 15:44:02 -0700 (PDT), mg <mgkelson@yahoo.com>
wrote:

>On Apr 28, 9:59?am, Gary <n...@none.com> wrote:
>> On Sat, 27 Apr 2013 20:42:40 -0700 (PDT), mg <mgkel...@yahoo.com>
>> wrote:
>>
>> > In this case, we think
>> >there's going to be more competition with the increase in taxes. My
>> >bet, though, is that there will be less.
>>
>> Competition ? ? ?Do you think Amazon is paying lobbyists millions of
>> dollars to bribe Congressmen into legislating anything that would
>> smack of "competition" ?
>
>Amazon, incidentally, is a great place to buy stuff. I'm a huge Amazon
>fan. Except for groceries and building materials, I rarely buy
>anything from brick and mortar stores.

I've been wanting to buy some things from them. Like books. But
my problem is this. I have never used a credit card on the internet.
Crazy -- I know. But it bothers me. I figure I could charge $50
and end up with a bill for $5,000.

And Amazon is not real good about explaining things to me -- unless I
sign up and am a member. I wonder --- if I buy one of these
limited credit cards at the grocery store -- would they accept them ?

My understanding is you can't lose any more than what you pay for the
card. Like $100 or $200.

>The only thing that kind of
>just sits on the back of my mind is whether or not there will
>eventually be a big price hike after they have ran everybody else out
>of business.

Probably. Like all large corporations -- they hate competition like
a vampire hates holy water. And when there is no more competition
-- they do as they please.

Islander

4/29/2013 12:24:00 AM

0

On 4/28/2013 4:04 PM, Gary wrote:
> I've been wanting to buy some things from them. Like books. But
> my problem is this. I have never used a credit card on the internet.
> Crazy -- I know. But it bothers me. I figure I could charge $50
> and end up with a bill for $5,000.
>
> And Amazon is not real good about explaining things to me -- unless I
> sign up and am a member. I wonder --- if I buy one of these
> limited credit cards at the grocery store -- would they accept them ?
>
> My understanding is you can't lose any more than what you pay for the
> card. Like $100 or $200.

Under federal law, you have no liability if someone uses your credit
card number to make purchases that were not authorized by you.
Otherwise, you have only $50 liability for unauthorized purchases if
your card was physically stolen regardless of how much was charged to it.

Many credit card companies are now motivated to catch thiefs before they
charge very much because they have all the liability. This is a good
thing! Last week, we got a call from our credit card company
questioning a couple of purchases, one at Walmart. They knew from our
habits in using the card that we do not shop at Walmart. All
unauthorized charges were eliminated and we received a new card in two
days. It was a bit of a pain to change billing arrangements that we
have, but not as much pain as it would have been to prove that we did
not make the charges. The company representative who called was polite
and business-like.

You are not as well protected for debit or ATM cards. For these, you
have an obligation to report a stolen card immediately. Your liability
is $50 after two days and $500 if you do not catch it in your bank
statement within 60 days. After that you are responsible for all
unauthorized charges. I would not own a debt card!

Gary

4/29/2013 12:45:00 AM

0

On Sun, 28 Apr 2013 17:24:06 -0700, Islander <nospam@priracy.net>
wrote:

>On 4/28/2013 4:04 PM, Gary wrote:
>> I've been wanting to buy some things from them. Like books. But
>> my problem is this. I have never used a credit card on the internet.
>> Crazy -- I know. But it bothers me. I figure I could charge $50
>> and end up with a bill for $5,000.
>>
>> And Amazon is not real good about explaining things to me -- unless I
>> sign up and am a member. I wonder --- if I buy one of these
>> limited credit cards at the grocery store -- would they accept them ?
>>
>> My understanding is you can't lose any more than what you pay for the
>> card. Like $100 or $200.
>
>Under federal law, you have no liability if someone uses your credit
>card number to make purchases that were not authorized by you.
>Otherwise, you have only $50 liability for unauthorized purchases if
>your card was physically stolen regardless of how much was charged to it.

I've heard that, but I've always dreaded experiencing it.

>Many credit card companies are now motivated to catch thiefs before they
>charge very much because they have all the liability. This is a good
>thing! Last week, we got a call from our credit card company
>questioning a couple of purchases, one at Walmart. They knew from our
>habits in using the card that we do not shop at Walmart. All
>unauthorized charges were eliminated and we received a new card in two
>days. It was a bit of a pain to change billing arrangements that we
>have, but not as much pain as it would have been to prove that we did
>not make the charges. The company representative who called was polite
>and business-like.
>
>You are not as well protected for debit or ATM cards. For these, you
>have an obligation to report a stolen card immediately. Your liability
>is $50 after two days and $500 if you do not catch it in your bank
>statement within 60 days. After that you are responsible for all
>unauthorized charges. I would not own a debt card!

Really ! I'm thinking about these cards you buy for so much. Like
$200. I thought that was the limit. You mean somebody can
actually hold me responsible if somebody lies and claims it is for
$5,000 ? That is scary.

I'm not real knowledgeable about credit cards. We've always had one
or two, but we never used them much. Just enough to keep up our
credit.

High Miles

4/29/2013 1:49:00 AM

0

On 4/28/2013 6:04 PM, Gary wrote:
> On Sun, 28 Apr 2013 15:44:02 -0700 (PDT), mg <mgkelson@yahoo.com>
> wrote:
>
>> On Apr 28, 9:59 am, Gary <n...@none.com> wrote:
>>> On Sat, 27 Apr 2013 20:42:40 -0700 (PDT), mg <mgkel...@yahoo.com>
>>> wrote:
>>>
>>>> In this case, we think
>>>> there's going to be more competition with the increase in taxes. My
>>>> bet, though, is that there will be less.
>>> Competition ? Do you think Amazon is paying lobbyists millions of
>>> dollars to bribe Congressmen into legislating anything that would
>>> smack of "competition" ?
>> Amazon, incidentally, is a great place to buy stuff. I'm a huge Amazon
>> fan. Except for groceries and building materials, I rarely buy
>> anything from brick and mortar stores.
> I've been wanting to buy some things from them. Like books. But
> my problem is this. I have never used a credit card on the internet.
> Crazy -- I know. But it bothers me. I figure I could charge $50
> and end up with a bill for $5,000.
>
> And Amazon is not real good about explaining things to me -- unless I
> sign up and am a member. I wonder --- if I buy one of these
> limited credit cards at the grocery store -- would they accept them ?
>
> My understanding is you can't lose any more than what you pay for the
> card. Like $100 or $200.
>
>> The only thing that kind of
>> just sits on the back of my mind is whether or not there will
>> eventually be a big price hike after they have ran everybody else out
>> of business.
> Probably. Like all large corporations -- they hate competition like
> a vampire hates holy water. And when there is no more competition
> -- they do as they please.
<>
I love 'em.
Even if they work their people down to the nub.
Their service is excellentand return policy is liberal.
Never had the first problem in dealings with them,or in using a credit card.
Years and years of good relations.
And
A one hundred dollar "store" bought card can not be used for more.


High Miles

4/29/2013 1:55:00 AM

0

On 4/28/2013 7:24 PM, Islander wrote:
> On 4/28/2013 4:04 PM, Gary wrote:
>> I've been wanting to buy some things from them. Like books. But
>> my problem is this. I have never used a credit card on the internet.
>> Crazy -- I know. But it bothers me. I figure I could charge $50
>> and end up with a bill for $5,000.
>>
>> And Amazon is not real good about explaining things to me -- unless I
>> sign up and am a member. I wonder --- if I buy one of these
>> limited credit cards at the grocery store -- would they accept them ?
>>
>> My understanding is you can't lose any more than what you pay for the
>> card. Like $100 or $200.
>
> Under federal law, you have no liability if someone uses your credit
> card number to make purchases that were not authorized by you.
> Otherwise, you have only $50 liability for unauthorized purchases if
> your card was physically stolen regardless of how much was charged to it.
>
> Many credit card companies are now motivated to catch thiefs before
> they charge very much because they have all the liability. This is a
> good thing! Last week, we got a call from our credit card company
> questioning a couple of purchases, one at Walmart. They knew from our
> habits in using the card that we do not shop at Walmart. All
> unauthorized charges were eliminated and we received a new card in two
> days. It was a bit of a pain to change billing arrangements that we
> have, but not as much pain as it would have been to prove that we did
> not make the charges. The company representative who called was
> polite and business-like.
>
> You are not as well protected for debit or ATM cards. For these, you
> have an obligation to report a stolen card immediately. Your
> liability is $50 after two days and $500 if you do not catch it in
> your bank statement within 60 days. After that you are responsible
> for all unauthorized charges. I would not own a debt card!
>
><

I've carried and used a debit card from my credit union for many years,
and have never had a problemof any sort.
Of course, I don't keep thousands of dollars in that account, so even
in the event of theft, I wouldn't lose very much.

High Miles

4/29/2013 1:57:00 AM

0

On 4/28/2013 7:45 PM, Gary wrote:
> On Sun, 28 Apr 2013 17:24:06 -0700, Islander <nospam@priracy.net>
> wrote:
>
>> On 4/28/2013 4:04 PM, Gary wrote:
>>> I've been wanting to buy some things from them. Like books. But
>>> my problem is this. I have never used a credit card on the internet.
>>> Crazy -- I know. But it bothers me. I figure I could charge $50
>>> and end up with a bill for $5,000.
>>>
>>> And Amazon is not real good about explaining things to me -- unless I
>>> sign up and am a member. I wonder --- if I buy one of these
>>> limited credit cards at the grocery store -- would they accept them ?
>>>
>>> My understanding is you can't lose any more than what you pay for the
>>> card. Like $100 or $200.
>> Under federal law, you have no liability if someone uses your credit
>> card number to make purchases that were not authorized by you.
>> Otherwise, you have only $50 liability for unauthorized purchases if
>> your card was physically stolen regardless of how much was charged to it.
> I've heard that, but I've always dreaded experiencing it.
>
>> Many credit card companies are now motivated to catch thiefs before they
>> charge very much because they have all the liability. This is a good
>> thing! Last week, we got a call from our credit card company
>> questioning a couple of purchases, one at Walmart. They knew from our
>> habits in using the card that we do not shop at Walmart. All
>> unauthorized charges were eliminated and we received a new card in two
>> days. It was a bit of a pain to change billing arrangements that we
>> have, but not as much pain as it would have been to prove that we did
>> not make the charges. The company representative who called was polite
>> and business-like.
>>
>> You are not as well protected for debit or ATM cards. For these, you
>> have an obligation to report a stolen card immediately. Your liability
>> is $50 after two days and $500 if you do not catch it in your bank
>> statement within 60 days. After that you are responsible for all
>> unauthorized charges. I would not own a debt card!
> Really ! I'm thinking about these cards you buy for so much. Like
> $200. I thought that was the limit. You mean somebody can
> actually hold me responsible if somebody lies and claims it is for
> $5,000 ? That is scary.
>
> I'm not real knowledgeable about credit cards. We've always had one
> or two, but we never used them much. Just enough to keep up our
> credit.
><

Just call the outfit that supplies your card and askabout your concerns.


Planet Visitor II

4/29/2013 4:32:00 AM

0

On Sun, 28 Apr 2013 19:04:06 -0400, Gary <nov@none.com> wrote:

>On Sun, 28 Apr 2013 15:44:02 -0700 (PDT), mg <mgkelson@yahoo.com>
>wrote:
>
>>On Apr 28, 9:59?am, Gary <n...@none.com> wrote:
>>> On Sat, 27 Apr 2013 20:42:40 -0700 (PDT), mg <mgkel...@yahoo.com>
>>> wrote:
>>>
>>> > In this case, we think
>>> >there's going to be more competition with the increase in taxes. My
>>> >bet, though, is that there will be less.
>>>
>>> Competition ? ? ?Do you think Amazon is paying lobbyists millions of
>>> dollars to bribe Congressmen into legislating anything that would
>>> smack of "competition" ?
>>
>>Amazon, incidentally, is a great place to buy stuff. I'm a huge Amazon
>>fan. Except for groceries and building materials, I rarely buy
>>anything from brick and mortar stores.
>
>I've been wanting to buy some things from them. Like books. But
>my problem is this. I have never used a credit card on the internet.
>Crazy -- I know. But it bothers me. I figure I could charge $50
>and end up with a bill for $5,000.
>
>And Amazon is not real good about explaining things to me -- unless I
>sign up and am a member. I wonder --- if I buy one of these
>limited credit cards at the grocery store -- would they accept them ?
>
>My understanding is you can't lose any more than what you pay for the
>card. Like $100 or $200.
>

Get yourself a Bank of America Checking Account. You can then get a credit
card from them, but NEVER need to use it for ANY purchase. You would
only need it to go on line to the Bank of America and use THEIR service to
create as many one-time use credit cards as you wish, each with individual
numbers, individual security codes, valid ending dates if even one month, and a
secret spending limit for a one-time purchase that a vendor does not have
access to.

No vendor could access your card twice, nor exceed the limit YOU set. This is
what Bank of America calls their "ShopSafe" system. I use it for every on-line
purchase. See --
https://www.bankofamerica.com/privacy/accounts-cards/s...

Of course, PayPal is also secure, but not as secure as a one-time chit that can
never be used again, or fraudulently accessed through any password breach,
as long as your Bank of America password is a random password. However;
I can't believe anyone would create an easy to break password to their entire
checking account.


Planet Visitor II

Islander

4/29/2013 4:00:00 PM

0

On 4/28/2013 6:55 PM, High Miles wrote:
> On 4/28/2013 7:24 PM, Islander wrote:
>> On 4/28/2013 4:04 PM, Gary wrote:
>>> I've been wanting to buy some things from them. Like books. But
>>> my problem is this. I have never used a credit card on the internet.
>>> Crazy -- I know. But it bothers me. I figure I could charge $50
>>> and end up with a bill for $5,000.
>>>
>>> And Amazon is not real good about explaining things to me -- unless I
>>> sign up and am a member. I wonder --- if I buy one of these
>>> limited credit cards at the grocery store -- would they accept them ?
>>>
>>> My understanding is you can't lose any more than what you pay for the
>>> card. Like $100 or $200.
>>
>> Under federal law, you have no liability if someone uses your credit
>> card number to make purchases that were not authorized by you.
>> Otherwise, you have only $50 liability for unauthorized purchases if
>> your card was physically stolen regardless of how much was charged to it.
>>
>> Many credit card companies are now motivated to catch thiefs before
>> they charge very much because they have all the liability. This is a
>> good thing! Last week, we got a call from our credit card company
>> questioning a couple of purchases, one at Walmart. They knew from our
>> habits in using the card that we do not shop at Walmart. All
>> unauthorized charges were eliminated and we received a new card in two
>> days. It was a bit of a pain to change billing arrangements that we
>> have, but not as much pain as it would have been to prove that we did
>> not make the charges. The company representative who called was
>> polite and business-like.
>>
>> You are not as well protected for debit or ATM cards. For these, you
>> have an obligation to report a stolen card immediately. Your
>> liability is $50 after two days and $500 if you do not catch it in
>> your bank statement within 60 days. After that you are responsible
>> for all unauthorized charges. I would not own a debt card!
>>
> ><
>
> I've carried and used a debit card from my credit union for many years,
> and have never had a problemof any sort.
> Of course, I don't keep thousands of dollars in that account, so even
> in the event of theft, I wouldn't lose very much.
>
What I have described above are the federal laws governing credit and
debit cards. There is nothing to prevent your local credit union from
setting more stringent rules as long as they are within the federal
limits. Perhaps that is the case for your experience.

Islander

4/29/2013 4:10:00 PM

0

On 4/28/2013 5:45 PM, Gary wrote:
> Really ! I'm thinking about these cards you buy for so much. Like
> $200. I thought that was the limit. You mean somebody can
> actually hold me responsible if somebody lies and claims it is for
> $5,000 ? That is scary.

No, I described the federal rules for credit and debit cards, not for
the store-bought cards which have a stored value that cannot be
exceeded. Be sure, however, that you do not inadvertently purchase a
pre-paid debit card which might be linked to your bank account (so that
you can conveniently add value to it - and so can a thief). The
stored-value cards have no link to you or your account and are as
anonymous as cash. I don't know if on-line companies honor them.

Islander

4/29/2013 4:12:00 PM

0

On 4/28/2013 9:31 PM, Planet Visitor II wrote:
> On Sun, 28 Apr 2013 19:04:06 -0400, Gary <nov@none.com> wrote:
>
>> On Sun, 28 Apr 2013 15:44:02 -0700 (PDT), mg <mgkelson@yahoo.com>
>> wrote:
>>
>>> On Apr 28, 9:59 am, Gary <n...@none.com> wrote:
>>>> On Sat, 27 Apr 2013 20:42:40 -0700 (PDT), mg <mgkel...@yahoo.com>
>>>> wrote:
>>>>
>>>>> In this case, we think
>>>>> there's going to be more competition with the increase in taxes. My
>>>>> bet, though, is that there will be less.
>>>>
>>>> Competition ? Do you think Amazon is paying lobbyists millions of
>>>> dollars to bribe Congressmen into legislating anything that would
>>>> smack of "competition" ?
>>>
>>> Amazon, incidentally, is a great place to buy stuff. I'm a huge Amazon
>>> fan. Except for groceries and building materials, I rarely buy
>>> anything from brick and mortar stores.
>>
>> I've been wanting to buy some things from them. Like books. But
>> my problem is this. I have never used a credit card on the internet.
>> Crazy -- I know. But it bothers me. I figure I could charge $50
>> and end up with a bill for $5,000.
>>
>> And Amazon is not real good about explaining things to me -- unless I
>> sign up and am a member. I wonder --- if I buy one of these
>> limited credit cards at the grocery store -- would they accept them ?
>>
>> My understanding is you can't lose any more than what you pay for the
>> card. Like $100 or $200.
>>
>
> Get yourself a Bank of America Checking Account. You can then get a credit
> card from them, but NEVER need to use it for ANY purchase. You would
> only need it to go on line to the Bank of America and use THEIR service to
> create as many one-time use credit cards as you wish, each with individual
> numbers, individual security codes, valid ending dates if even one month, and a
> secret spending limit for a one-time purchase that a vendor does not have
> access to.
>
> No vendor could access your card twice, nor exceed the limit YOU set. This is
> what Bank of America calls their "ShopSafe" system. I use it for every on-line
> purchase. See --
> https://www.bankofamerica.com/privacy/accounts-cards/s...
>
> Of course, PayPal is also secure, but not as secure as a one-time chit that can
> never be used again, or fraudulently accessed through any password breach,
> as long as your Bank of America password is a random password. However;
> I can't believe anyone would create an easy to break password to their entire
> checking account.
>
>
> Planet Visitor II
>
I wouldn't go to BoA for *any* financial service. Our experience with
them was horrible!