Beginner BPSK demodulation question
An "integrate and dump" filter is a common approach for this application, which is essentially an averaging filter averaged optimally over your symbol period. To implement this, you simply reset your accumulator at the symbol boundaries, accumulate your output over the symbol period and then "dump" your result by taking the accumulated output as the result before resetting it again. For a rectangular pulse shape BPSK in the presence of additive white Guassian noise, this is the optimum matched filter.

Note, unless you have a shared clock between your transmitter and receiver, you will likely also need to implement some form of carrier recovery to track clock variations between your transmitter and receiver (otherwise once you drift 90 degrees, your cosine will be a sine and you will get no output in that condition!). And as described above, you will need some form of timing recovery to establish when your start of the symbols are referenced to your signal as received.

I have detailed these in the following posts:

Phase synchronization in BPSK

Recovering signal for psk

Gardner Timing Recovery for Repeated Sybmols